refactor: shorten verbose variable names across codebase
This commit is contained in:
@@ -195,7 +195,7 @@ func buildAllowedWatchOrderEntries(result watchorder.WatchOrderResult, mode Watc
|
||||
break
|
||||
}
|
||||
}
|
||||
shouldIncludeAllTypes := mode == WatchOrderModeComplete || !hasTVEntry
|
||||
allTypes := mode == WatchOrderModeComplete || !hasTVEntry
|
||||
|
||||
for _, entry := range result.WatchOrder {
|
||||
if len(allowedEntries) >= maxWatchOrderEntries {
|
||||
@@ -204,8 +204,8 @@ func buildAllowedWatchOrderEntries(result watchorder.WatchOrderResult, mode Watc
|
||||
if seen[entry.ID] {
|
||||
continue
|
||||
}
|
||||
normalizedType := strings.ToLower(strings.TrimSpace(entry.Type))
|
||||
if !shouldIncludeAllTypes && normalizedType != "tv" && normalizedType != "movie" {
|
||||
typ := strings.ToLower(strings.TrimSpace(entry.Type))
|
||||
if !allTypes && typ != "tv" && typ != "movie" {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -293,13 +293,13 @@ func parseM3U8Sources(body string, masterURL string, referer string) []StreamSou
|
||||
lines := strings.Split(body, "\n")
|
||||
baseURL := playlistBaseURL(masterURL)
|
||||
bwPattern := regexp.MustCompile(`BANDWIDTH=(\d+)`)
|
||||
currentBandwidth := 0
|
||||
bw := 0
|
||||
sources := make([]StreamSource, 0)
|
||||
|
||||
for _, line := range lines {
|
||||
trimmed := strings.TrimSpace(line)
|
||||
if bandwidth, ok := parseStreamBandwidth(trimmed, bwPattern); ok {
|
||||
currentBandwidth = bandwidth
|
||||
bw = bandwidth
|
||||
continue
|
||||
}
|
||||
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
|
||||
@@ -313,7 +313,7 @@ func parseM3U8Sources(body string, masterURL string, referer string) []StreamSou
|
||||
|
||||
sources = append(sources, StreamSource{
|
||||
URL: streamURL,
|
||||
Quality: qualityFromBandwidth(currentBandwidth),
|
||||
Quality: qualityFromBandwidth(bw),
|
||||
Provider: "hls",
|
||||
Type: "m3u8",
|
||||
Referer: referer,
|
||||
|
||||
@@ -101,7 +101,7 @@ func (c *AllAnimeProvider) Search(ctx context.Context, query string, mode string
|
||||
|
||||
func (c *AllAnimeProvider) resolveShowIDWithFallback(ctx context.Context, animeID int, titleCandidates []string, mode string) string {
|
||||
targetMalIDStr := strconv.Itoa(animeID)
|
||||
firstAvailableShowID := ""
|
||||
fallbackID := ""
|
||||
|
||||
for _, title := range titleCandidates {
|
||||
searchResults, err := c.Search(ctx, title, mode)
|
||||
@@ -111,12 +111,12 @@ func (c *AllAnimeProvider) resolveShowIDWithFallback(ctx context.Context, animeI
|
||||
if showID := exactMatchShowID(searchResults, targetMalIDStr); showID != "" {
|
||||
return showID
|
||||
}
|
||||
if firstAvailableShowID == "" {
|
||||
firstAvailableShowID = searchResults[0].ID
|
||||
if fallbackID == "" {
|
||||
fallbackID = searchResults[0].ID
|
||||
}
|
||||
}
|
||||
|
||||
return firstAvailableShowID
|
||||
return fallbackID
|
||||
}
|
||||
|
||||
func exactMatchShowID(searchResults []searchResult, targetMalID string) string {
|
||||
|
||||
@@ -212,7 +212,7 @@ func buildSourceReferences(rawSourceURLs []any) []sourceReference {
|
||||
|
||||
ref := sourceReference{URL: sourceURL, Name: sourceName}
|
||||
normalized := strings.ToLower(sourceName)
|
||||
if _, prioritizedProvider := prioritySet[normalized]; prioritizedProvider {
|
||||
if _, priority := prioritySet[normalized]; priority {
|
||||
if _, exists := prioritized[normalized]; !exists {
|
||||
prioritized[normalized] = ref
|
||||
}
|
||||
|
||||
@@ -156,13 +156,13 @@ func extractRows(doc *goquery.Document) []watchOrderRow {
|
||||
}
|
||||
|
||||
title := strings.TrimSpace(selection.Find(".wo_title").First().Text())
|
||||
alternativeTitle := strings.TrimSpace(selection.Find(".uk-text-small").First().Text())
|
||||
alt := strings.TrimSpace(selection.Find(".uk-text-small").First().Text())
|
||||
|
||||
rows = append(rows, watchOrderRow{
|
||||
id: id,
|
||||
typeID: typeID,
|
||||
title: title,
|
||||
alternativeTitle: alternativeTitle,
|
||||
alternativeTitle: alt,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user