Skip to content

Commit

Permalink
Reset index to 0 after find_media
Browse files Browse the repository at this point in the history
  • Loading branch information
Knucklessg1 committed Apr 27, 2024
1 parent 53e8e1a commit 55cda95
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions media_manager/media_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ async def set_audio_metadata(self) -> None:
and f"{self.audio_tags['tracktitle'].first}{self.file_extension}" == self.media_file.split('-')[
1].strip():
print("File metadata is already set, moving on...")
self.media_file_index += 1
return

print(f"\t⚡ Shazam ⚡ {self.media_file}...")
Expand Down Expand Up @@ -543,8 +542,8 @@ async def set_audio_metadata(self) -> None:
f"\t\tGenre: {self.audio_tags['genre']}\n"
f"\t\tCover Art URL: {song['track']['images']['coverart']}\n"
f"\tMetadata Saved Successfully!")
self.media_file_index = 0
self.find_media()
self.media_file_index = 0

# Check if media metadata title is the same as what is proposed
def set_video_metadata(self) -> None:
Expand Down Expand Up @@ -672,13 +671,12 @@ def set_video_metadata(self) -> None:
os.remove(self.new_media_file_path)
os.rename(self.temporary_media_file_path, self.new_media_file_path)
self.media_file_index = 0
else:
self.media_file_index += 1
self.completed_media_files.append(self.media_files[current_index])
logging.debug(f"Completed File: {self.completed_media_files[len(self.completed_media_files) - 1]}\n"
f"All Completed Files: {self.completed_media_files}")
logging.debug(f"\tMetadata Updated: {os.path.basename(self.new_media_file_path)}")
self.find_media()
self.media_file_index = 0

# Rename directory
def rename_directory(self) -> None:
Expand Down Expand Up @@ -782,6 +780,7 @@ def clean_media(self) -> None:
self.set_media_metadata()
self.rename_file()
self.rename_directory()
self.media_file_index += 1
self.reset_variables()

# Move media to new destination
Expand Down Expand Up @@ -977,7 +976,7 @@ def media_manager(argv):
media_manager_instance.move_media(target_directory=media_directory, media_type="media")
if music_flag:
media_manager_instance.move_media(target_directory=music_directory, media_type="music")
print("Complete!")
print("\nComplete!")


def usage():
Expand Down

0 comments on commit 55cda95

Please sign in to comment.