Skip to content

Commit 56c37d8

Browse files
committed
feat: improve library emoji detection with comprehensive mappings and priority-based matching
1 parent 2b08f41 commit 56c37d8

File tree

1 file changed

+130
-9
lines changed

1 file changed

+130
-9
lines changed

cogs/jellyfin_core.py

Lines changed: 130 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,143 @@
1212
from main import is_authorized
1313
import asyncio
1414

15-
# Library name to emoji mapping
15+
# Library name to emoji mapping with priority order
1616
LIBRARY_EMOJIS = {
17+
# Movies and Films
1718
"movies": "🎬",
1819
"movie": "🎬",
1920
"films": "🎬",
21+
"cinema": "🎬",
22+
"feature": "🎬",
23+
24+
# TV Shows and Series
2025
"tv": "📺",
2126
"television": "📺",
2227
"shows": "📺",
2328
"series": "📺",
29+
"episodes": "📺",
30+
"seasons": "📺",
31+
32+
# Anime and Cartoons
33+
"anime": "🎌",
34+
"cartoons": "🎌",
35+
"animation": "🎌",
36+
"manga": "🎌",
37+
"japanese": "🎌",
38+
"anime movies": "🎌",
39+
"anime series": "🎌",
40+
41+
# Documentaries
42+
"documentaries": "📽️",
43+
"docs": "📽️",
44+
"documentary": "📽️",
45+
"educational": "📽️",
46+
"learning": "📽️",
47+
"science": "🔬",
48+
"history": "📜",
49+
"nature": "🌿",
50+
"wildlife": "🦁",
51+
52+
# Music
2453
"music": "🎵",
2554
"songs": "🎵",
55+
"albums": "🎵",
56+
"artists": "🎵",
57+
"playlists": "🎵",
58+
"audio": "🎵",
59+
"concerts": "🎤",
60+
"live": "🎤",
61+
62+
# Books and Audiobooks
2663
"books": "📚",
2764
"audiobooks": "📚",
65+
"literature": "📚",
66+
"reading": "📚",
67+
"novels": "📚",
68+
69+
# Photos and Images
2870
"photos": "📸",
2971
"pictures": "📸",
3072
"images": "📸",
73+
"photography": "📸",
74+
"gallery": "📸",
75+
76+
# Home Videos
3177
"home videos": "🎥",
3278
"videos": "🎥",
33-
"anime": "🎎",
34-
"cartoons": "🎎",
35-
"documentaries": "📽️",
36-
"docs": "📽️",
79+
"recordings": "🎥",
80+
"family videos": "🎥",
81+
"personal": "🎥",
82+
83+
# Kids and Family
3784
"kids": "👶",
3885
"children": "👶",
3986
"family": "👶",
40-
"default": "📁" # Default emoji for unmatched libraries
87+
"cartoons": "👶",
88+
"educational": "👶",
89+
"learning": "👶",
90+
"kids movies": "👶",
91+
"kids shows": "👶",
92+
"family movies": "👶",
93+
94+
# Sports
95+
"sports": "⚽",
96+
"football": "⚽",
97+
"soccer": "⚽",
98+
"basketball": "🏀",
99+
"baseball": "⚾",
100+
"tennis": "🎾",
101+
"golf": "⛳",
102+
"racing": "🏎️",
103+
"olympics": "🏅",
104+
"matches": "⚽",
105+
"games": "🎮",
106+
107+
# Foreign Content
108+
"foreign": "🌍",
109+
"international": "🌍",
110+
"world": "🌍",
111+
112+
# Korean Content
113+
"korean": "🇰🇷",
114+
"korea": "🇰🇷",
115+
"k-drama": "🇰🇷",
116+
"kdrama": "🇰🇷",
117+
"kpop": "🇰🇷",
118+
119+
# German Content
120+
"german": "🇩🇪",
121+
"deutsch": "🇩🇪",
122+
"germany": "🇩🇪",
123+
124+
# French Content
125+
"french": "🇫🇷",
126+
"france": "🇫🇷",
127+
"français": "🇫🇷",
128+
129+
# Additional Categories
130+
"comedy": "😂",
131+
"standup": "😂",
132+
"horror": "👻",
133+
"thriller": "🔪",
134+
"action": "💥",
135+
"adventure": "🗺️",
136+
"drama": "🎭",
137+
"romance": "💕",
138+
"scifi": "🚀",
139+
"fantasy": "🧙",
140+
"classic": "🎭",
141+
"indie": "🎨",
142+
"bollywood": "🎭",
143+
"hollywood": "🎬",
144+
"4k": "📺",
145+
"uhd": "📺",
146+
"hdr": "📺",
147+
"dolby": "🎵",
148+
"atmos": "🎵",
149+
150+
# Default fallback
151+
"default": "📁"
41152
}
42153

43154
RUNNING_IN_DOCKER = os.getenv("RUNNING_IN_DOCKER", "false").lower() == "true"
@@ -333,12 +444,22 @@ def get_library_stats(self) -> Dict[str, Dict[str, Any]]:
333444
"show_episodes": False
334445
})
335446

336-
# Find matching emoji based on library name
447+
# Find matching emoji based on library name with priority
337448
emoji = LIBRARY_EMOJIS["default"]
449+
best_match_length = 0
450+
338451
for key, value in LIBRARY_EMOJIS.items():
452+
if key == "default":
453+
continue
339454
if key in library_name:
340-
emoji = value
341-
break
455+
# If this match is longer than our current best match, use it
456+
if len(key) > best_match_length:
457+
best_match_length = len(key)
458+
emoji = value
459+
460+
# If we found a match in the config, use that instead
461+
if config.get("emoji"):
462+
emoji = config["emoji"]
342463

343464
# Get item counts
344465
params = {

0 commit comments

Comments
 (0)