Skip to content

Commit 5cacdfb

Browse files
committed
filter at the end too
1 parent b1f5c21 commit 5cacdfb

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

docs/examples/genre_update.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
from mutagen import File
77

8-
updatefile = "genre todo.txt"
9-
for arguments in sys.argv:
10-
if arguments[:3] == '/f:':
11-
updatefile = arguments[3:]
12-
138

149
def update_music_metadata(ampache_connection, update_list):
1510
""" update_music_metadata
@@ -53,8 +48,9 @@ def update_music_metadata(ampache_connection, update_list):
5348
if change:
5449
print(f"{id} updated {music_file}\n {existing_genres} => {genres}\n")
5550
else:
56-
print("No change " + id)
51+
print(f"{id} NO CHANGE {music_file}")
5752
print(genres)
53+
print()
5854
else:
5955
# Not found online, filter your existing genres anyway
6056
print("No data found " + id + " filter existing genres")
@@ -81,8 +77,9 @@ def update_music_metadata(ampache_connection, update_list):
8177
if change:
8278
print(f"{id} updated {music_file}\n {existing_genres} => {genres}\n")
8379
else:
84-
print("No change " + id)
80+
print(f"{id} NO CHANGE {music_file}")
8581
print(genres)
82+
print()
8683
# Always update from tags to make sure other changes are set even if we didn't find anything now
8784
print(ampache_connection.execute('update_from_tags', {'object_type': 'album', 'object_id': id } ))
8885
time.sleep(5)
@@ -120,7 +117,7 @@ def get_external_genres(ampache_connection, album_id):
120117
plugin_genres = [plugin_genres[key] for key in sorted(plugin_genres, key=int)] # Sort keys numerically
121118
else:
122119
plugin_genres = list(plugin_genres.values())
123-
genres.extend(plugin_genres)
120+
genres.extend(filter_genres(plugin_genres))
124121
return genres if genres else False
125122

126123

0 commit comments

Comments
 (0)