Skip to content

Commit

Permalink
fix: handle files with uppercase extension
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Feb 3, 2022
1 parent 3c33209 commit 74e8648
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gridplayer/player/managers/drag_n_drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def dropEvent(self, event):

# Add new video
if drop_files:
if drop_files[0].suffix == ".gpls":
if drop_files[0].suffix.lower() == ".gpls":
self.playlist_dropped.emit(drop_files[0])
else:
videos = [Video(file_path=f, title=f.name) for f in drop_files]
Expand Down
4 changes: 2 additions & 2 deletions gridplayer/player/managers/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def cmd_save_playlist(self):
# filename placeholder is not available if file doesn't exist
# problematic for new playlists, need to prevent accidental overwrite
# occurs in Flatpak, maybe in other sandboxes that use portal
if file_path.suffix != ".gpls":
if file_path.suffix.lower() != ".gpls":
file_path = file_path.with_suffix(".gpls")

if self._is_overwrite_denied(file_path):
Expand All @@ -106,7 +106,7 @@ def process_arguments(self, argv):
self.error.emit(tr("No supported files!"))
return

if files[0].suffix == ".gpls":
if files[0].suffix.lower() == ".gpls":
self.load_playlist_file(files[0])
return

Expand Down
2 changes: 1 addition & 1 deletion gridplayer/utils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ def _filter_accesible_files(files: List[Path]) -> List[Path]:


def _filter_extensions(files: List[Path], extensions: Set[str]):
return [f for f in files if f.suffix[1:] in extensions]
return [f for f in files if f.suffix[1:].lower() in extensions]
2 changes: 1 addition & 1 deletion gridplayer/utils/next_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def _file_siblings(file: Path):
return sorted(
f
for f in file.parent.iterdir()
if f.is_file() and f.suffix[1:] in SUPPORTED_VIDEO_EXT
if f.is_file() and f.suffix[1:].lower() in SUPPORTED_VIDEO_EXT
)

0 comments on commit 74e8648

Please sign in to comment.