geigi / cozy

🎧 Listen to audio books 📚 on Linux
https://cozy.sh
GNU General Public License v3.0
1.1k stars 85 forks source link

Can't read files with certain symbols in filename #660

Open alexpattyn opened 2 years ago

alexpattyn commented 2 years ago

Bug/Feature description

Originally I was having an error where cozy couldn't read a file, even though it had access to it and it showed up in the library scan. However, it turns out this is an issue with it being unable to read files that have certain symbols in the $PATH, e.g. #.

Ideally it would be able to read files with these symbols. Or at the very least some error should be thrown to denote that the folder/filename has unsupported characters. Before I found out that it was the issue, I was just getting error messages saying unable to read resource and for me to manually locate the file - which was less clear since it showed up in the library scan, which made me think the folder/filename should be okay.

Steps to reproduce

  1. Add a symbol like # to the folder or filename.
  2. Update library via scan.
  3. Try to play file.

System Information

Error Output

$ flatpak run com.github.geigi.cozy 
['/app/bin/com.github.geigi.cozy']
22:54:33 [MainThread  ] [applicatio] [INFO ]  ('org.gnome.platform', '40', 'Flatpak runtime')
22:54:33 [MainThread  ] [applicatio] [INFO ]  Starting up cozy 1.1.2
22:54:33 [MainThread  ] [db        ] [INFO ]  SQLite version: 3.32.1
22:54:33 [MainThread  ] [db_updater] [INFO ]  Backing up DB...
22:54:33 [Thread-1    ] [peewee.sql] [INFO ]  writer received shutdown request, exiting.
22:54:33 [MainThread  ] [db_updater] [INFO ]  Migrating to DB Version 10...
22:54:33 [Thread-10   ] [peewee.sql] [INFO ]  writer received shutdown request, exiting.
22:54:33 [Thread-11   ] [peewee.sql] [INFO ]  writer received shutdown request, exiting.
22:54:33 [MainThread  ] [applicatio] [INFO ]  libhandy version: 1
22:54:33 [MainThread  ] [gst_player] [WARNI]  Could not set volume because player is not loaded.
22:54:33 [MainThread  ] [mediaplaye] [INFO ]  Loading new file for chapter.
22:54:33 [MainThread  ] [gst_player] [INFO ]  Dispose
22:54:38 [MainThread  ] [gst_player] [INFO ]  Failed to seek, counter expired.
22:54:38 [Thread-14   ] [offline_ca] [INFO ]  Started processing queue
22:54:38 [MainThread  ] [gst_player] [ERROR]  Could not determine volume because player is not loaded.
22:54:38 [MainThread  ] [gst_player] [WARNI]  Could not set volume because player is not loaded.
22:54:38 [MainThread  ] [ui        ] [INFO ]  Initialize main window
22:54:39 [MainThread  ] [ui        ] [INFO ]  Not connecting about close button.
22:54:39 [MainThread  ] [gst_player] [WARNI]  gst: Resource not found. Stopping player.
22:54:39 [MainThread  ] [gst_player] [ERROR]  5: gst-resource-error-quark: Could not open resource for reading. (5)
22:54:39 [MainThread  ] [gst_player] [ERROR]  4: gst-core-error-quark: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure. (4)
22:54:39 [MainThread  ] [mediaplaye] [WARNI]  No chapter loaded, cannot display file not found dialog.
22:54:39 [MainThread  ] [gst_player] [WARNI]  gst: Resource not found. Stopping player.
22:54:39 [MainThread  ] [gst_player] [ERROR]  5: gst-resource-error-quark: Could not open resource for reading. (5)
22:54:39 [MainThread  ] [gst_player] [ERROR]  4: gst-core-error-quark: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure. (4)
22:54:39 [MainThread  ] [gst_player] [ERROR]  Could not determine volume because player is not loaded.
22:55:08 [MainThread  ] [mediaplaye] [INFO ]  Loading new file for chapter.
22:55:08 [MainThread  ] [gst_player] [INFO ]  Dispose
22:55:13 [MainThread  ] [gst_player] [INFO ]  Failed to seek, counter expired.
22:55:13 [MainThread  ] [gst_player] [WARNI]  gst: Resource not found. Stopping player.
22:55:13 [MainThread  ] [gst_player] [ERROR]  5: gst-resource-error-quark: Could not open resource for reading. (5)
22:55:13 [MainThread  ] [gst_player] [ERROR]  4: gst-core-error-quark: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure. (4)
22:55:13 [MainThread  ] [mediaplaye] [WARNI]  No chapter loaded, cannot display file not found dialog.
22:55:13 [MainThread  ] [gst_player] [WARNI]  gst: Resource not found. Stopping player.
22:55:13 [MainThread  ] [gst_player] [ERROR]  5: gst-resource-error-quark: Could not open resource for reading. (5)
22:55:13 [MainThread  ] [gst_player] [ERROR]  4: gst-core-error-quark: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure. (4)
22:55:13 [MainThread  ] [gst_player] [ERROR]  Could not determine volume because player is not loaded.
geigi commented 2 years ago

Thanks for reporting this issue! I think the solution definitely should be to support any kind of file or directory name.