fatg3erman / RompR

Web client for Mopidy and MPD
https://fatg3erman.github.io/RompR/
Other
189 stars 22 forks source link

One album will not get its cover image #128

Closed tkgafs closed 2 years ago

tkgafs commented 2 years ago

I have some issue with one album which will not get its cover image for some unknown reason

I have updated rompr to version 1.60.1 this morning and also tried replacing the folder.jpg file with a differnt image but it has made no difference

a rompr debug file, nginx error.log, rompr debug.info and the offending folder.jpg file are all available at this url

https://rahane.ddns.net/nextcloud/s/wMx3S7KbsXAmEfr

this may have been like this for quite a while as i only noticed it yesterday, and its the only album apparently showing the issue out of about 2500 albums

there are no embedded images in the mp3 files

let me know if you need any other info to assist debugging

fatg3erman commented 2 years ago

There are some error messages, which are coming from getID3, which is not something I can fix. but in any case the fact it's trying to scan for local images means it didn't find folder.jpg. Given that it's only one album that suggests everything is working correctly so it's probably a permissions problem.

The directory it is trying to scan is

/www/nginx/rompr/prefs/MusicFolders/H/Hamza El Din - Eclipse

You should ensure that the web server has read access to that directory and to folder.jpg. Some distributions also require read permission to extend all the way up the directory tree to the root. prefs/MusicFolders is a symlink, so you might need to check the permissions of all directories above 'H' in the actual file system.

fatg3erman commented 2 years ago

Actually, having had another look at the code, I do actually scan the music files for images at the same time as I scan for local image files. So those errors from getID3 are probably indiciative of the issue. getID3 is an external library, so I can't fix it, but the fact it's failing suggests to me that there is a problem with the ID3 tags in the music files in that directory. You should fix them, maybe using Musicbrainz Picard.

tkgafs commented 2 years ago

I'm blowed if I can get to the bottom of the issue, the permissions on the files are identical to all the other folders the files are tagged using Mp3tag and mp3diag validates all the tags as being correct but strangest of all if I copy the folder.jpg file to cover.jpg in the same folder it works perfectly

I have also tried adding a completely new folder for another album and it works fine

most bizarre

tkgafs commented 2 years ago

Exporting the tags from the files using mp3tag gives the following

Title;Artist;Album;Track;Year;Length;Size;Last Modified;Path;Filename; Helalisa (Nubian Song);Hamza El Din;Eclipse;01;1978;228;8.68 MB;10/01/2022;Z:\Music\Include\H\Hamza El Din - Eclipse\;01 - Helalisa (Nubian Song).mp3; The Visitors;Hamza El Din;Eclipse;02;1978;602;22.96 MB;10/01/2022;Z:\Music\Include\H\Hamza El Din - Eclipse\;02 - The Visitors.mp3; Ollin Azageed;Hamza El Din;Eclipse;03;1978;511;19.48 MB;10/01/2022;Z:\Music\Include\H\Hamza El Din - Eclipse\;03 - Ollin Azageed.mp3; Your Love Is Ever Young;Hamza El Din;Eclipse;04;1978;1110;42.34 MB;10/01/2022;Z:\Music\Include\H\Hamza El Din - Eclipse\;04 - Your Love Is Ever Young.mp3; Mwashah;Hamza El Din;Eclipse;05;1978;224;8.56 MB;10/01/2022;Z:\Music\Include\H\Hamza El Din - Eclipse\;05 - Mwashah.mp3; build on 10/01/2022 with Mp3tag v3.11 - the universal Tag editor - http://www.mp3tag.de/en/

fatg3erman commented 2 years ago

I think this will remain a mystery. At a guess I'd say perhaps getID3 is reading your folder.jpg and having some trouble with it, but ignoring it when it is renamed to cover.jpg.

If you could send me one of the MP3s and the folder.jpg I could investigate. At least I might be able to trap the error if nothing else.

tkgafs commented 2 years ago

Mark

the entire folder is shared here https://rahane.ddns.net/nextcloud/s/wMx3S7KbsXAmEfr

I have discovered that if i comment out a line in the function scan_for_local_images I can get it to work, although I think its finding an image on lastFM ratehr than the local one

public static function scan_for_local_images($albumpath) { logger::log("LOCAL IMAGE SCAN", "Album Path Is ".$albumpath); logger::log("LOCAL IMAGE SCAN", getcwd()); $result = array(); logger::log("LOCAL IMAGE SCAN", "result is ",$result); if ((is_dir("prefs/MusicFolders") || is_link('prefs/MusicFolders')) && $albumpath != ".") { logger::log("LOCAL IMAGE SCAN", "IN IF "); $albumpath = self::munge_filepath($albumpath); logger::log("LOCAL IMAGE SCAN", "after munge albumpath is ",$albumpath); // ommitting next line makes it find image // $result = array_merge($result, self::get_images($albumpath)); // logger::log("LOCAL IMAGE SCAN", "IN IF result is ",$result); // Is the album dir part of a multi-disc set? if (preg_match('/^CD\s*\d+$|^disc\s*\d+$/i', basename($albumpath))) { $albumpath = dirname($albumpath); $result = array_merge($result, self::get_images($albumpath)); } // Are there any subdirectories? $globpath = preg_replace('/(\*|\?|\[)/', '[$1]', $albumpath); $lookfor = glob($globpath."/*", GLOB_ONLYDIR); foreach ($lookfor as $i => $f) { if (is_dir($f)) { $result = array_merge($result, self::get_images($f)); } } } else { logger::log('LOCAL IMAGE SCAN', 'Nope'); } return $result; } Debug Log with some additional debug lines of mine to try and work out logic of code

^[[90m10:40:03 [288] MARK : ^[[37mGETALBUMCOVER : ------- Searching For Album Art --------^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mGETALBUMCOVER : key = 34d0cfc67e14006ae4919bbad6fcf644^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mGETALBUMCOVER : artist = ^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mGETALBUMCOVER : album = ^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mGETALBUMCOVER : imgkey = 34d0cfc67e14006ae4919bbad6fcf644^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mGETALBUMCOVER : ignorelocal = false^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mALBUMIMAGE (construct) : Image Info From Database^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mBACKEND (get_album_directory) : Got album directory using track Uri : H/Hamza El Din - Eclipse^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mBACKEND (get_imagesearch_info) : Found album Eclipse ,in database^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mBACKEND (get_imagesearch_info) : Found album Eclipse ,in database^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mBACKEND (get_imagesearch_info) : Found album Eclipse ,in database^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mBACKEND (get_imagesearch_info) : Found album Eclipse ,in database^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mBACKEND (get_imagesearch_info) : Found album Eclipse ,in database^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mMOPIDYHTTP (probe_http_api) : Probing HTTP API^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mMOPIDYHTTP (probe_http_api) : Mopidy HTTP API Not Available^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mMPDPLAYER (check_mpd_version) : Version number 0.22 is <= MPD version 0.22.4^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mGETALBUMCOVER (tryMPD) : Trying MPD Images. TrackURI is H/Hamza El Din - Eclipse/01 - Helalisa (Nubian Song).mp3^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mREADPICTURE (readpicture) : Reading image from file H/Hamza El Din - Eclipse/01 - Helalisa (Nubian Song).mp3^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mMPDPLAYER (readpicture) : Reading at offset 0^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mMPD (do_mpd_command) : MPD Command readpicture "H/Hamza El Din - Eclipse/01 - Helalisa (Nubian Song).mp3" 0^[[0m ^[[90m10:40:03 [288] WARN : ^[[37mMPD : Socket Write Error for readpicture "H/Hamza El Din - Eclipse/01 - Helalisa (Nubian Song).mp3" 0 - Retrying^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mREADPICTURE (readpicture) : No binary data in response from MPD^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mMPDPLAYER (readpicture) : Reading at offset 0^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mMPD (do_mpd_command) : MPD Command readpicture "H/Hamza El Din - Eclipse/01 - Helalisa (Nubian Song).mp3" 0^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mREADPICTURE (readpicture) : No binary data in response from MPD^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mMPDPLAYER (readpicture) : Reading at offset 0^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mMPD (do_mpd_command) : MPD Command readpicture "H/Hamza El Din - Eclipse/01 - Helalisa (Nubian Song).mp3" 0^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mREADPICTURE (readpicture) : No binary data in response from MPD^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mGETALBUMCOVER (tryLastFMForMBID) : Image already has an MBID, skipping this step^[[0m ^[[90m10:40:03 [288] MARK : ^[[37mGETALBUMCOVER : Checking for local images^[[0m ^[[90m10:40:03 [288] MARK : ^[[37mGETALBUMCOVER : BEFORE scan_for_local_image^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mLOCAL IMAGE SCAN (scan_for_local_images) : Album Path Is H/Hamza El Din - Eclipse^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mLOCAL IMAGE SCAN (scan_for_local_images) : /www/nginx/rompr^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mLOCAL IMAGE SCAN (scan_for_local_images) : result is ^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mLOCAL IMAGE SCAN (scan_for_local_images) : IN IF ^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mLOCAL IMAGE SCAN (scan_for_local_images) : after munge albumpath is prefs/MusicFolders/H/Hamza El Din - Eclipse^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mLOCAL IMAGE SCAN (scan_for_local_images) : IN IF result is ^[[0m ^[[90m10:40:03 [288] MARK : ^[[37mGETALBUMCOVER : AFTER scan_for_local_image^[[0m ^[[90m10:40:03 [288] LOG : ^[[37mGETALBUMCOVER (trySpotify) : Not a Spotify album^[[0m ^[[90m10:40:03 [288] MARK : ^[[37mGETALBUMCOVER : Getting MusicBrainz release info for ^[[0m ^[[90m10:40:03 [288] TRACE : ^[[37mURL_DOWNLOADER (get_data_to_file) : Downloading to prefs/jsoncache/musicbrainz/a792f2473a11df7651221aa83b5b03ee^[[0m ^[[90m10:40:03 [288] WARN : ^[[37mURL_DOWNLOADER : .. Download Failed With Status Code 400^[[0m ^[[90m10:40:03 [288] WARN : ^[[37mCACHE HANDLER : There was an HTTP error^[[0m ^[[90m10:40:03 [288] WARN : ^[[37mCACHE HANDLER : 400 Bad Request^[[0m ^[[90m10:40:04 [288] LOG : ^[[37mGETALBUMCOVER (tryMusicBrainz) : Musicbrainz does not have artwork for this album^[[0m ^[[90m10:40:04 [288] MARK : ^[[37mGETALBUMCOVER : Trying last.FM for Hamza El Din Eclipse^[[0m ^[[90m10:40:04 [288] DEBUG : ^[[37mURL_DOWNLOADER (get_data_to_file) : Returning cached data prefs/jsoncache/lastfm/e711c0366dd5b14315d7fd123799c8d3^[[0m ^[[90m10:40:04 [288] TRACE : ^[[37mGETALBUMCOVER (tryLastFM) : Image small 'https://lastfm.freetls.fastly.net/i/u/34s/335ff369052d4c7ba3b092c43eac4e3d.png'^[[0m ^[[90m10:40:04 [288] TRACE : ^[[37mGETALBUMCOVER (tryLastFM) : Image medium 'https://lastfm.freetls.fastly.net/i/u/64s/335ff369052d4c7ba3b092c43eac4e3d.png'^[[0m ^[[90m10:40:04 [288] TRACE : ^[[37mGETALBUMCOVER (tryLastFM) : Image large 'https://lastfm.freetls.fastly.net/i/u/174s/335ff369052d4c7ba3b092c43eac4e3d.png'^[[0m ^[[90m10:40:04 [288] TRACE : ^[[37mGETALBUMCOVER (tryLastFM) : Image extralarge 'https://lastfm.freetls.fastly.net/i/u/300x300/335ff369052d4c7ba3b092c43eac4e3d.png'^[[0m ^[[90m10:40:04 [288] TRACE : ^[[37mGETALBUMCOVER (tryLastFM) : Image mega 'https://lastfm.freetls.fastly.net/i/u/300x300/335ff369052d4c7ba3b092c43eac4e3d.png'^[[0m ^[[90m10:40:04 [288] LOG : ^[[37mGETALBUMCOVER (tryLastFM) : Last.FM gave us https://lastfm.freetls.fastly.net/i/u/300x300/335ff369052d4c7ba3b092c43eac4e3d.png^[[0m ^[[90m10:40:04 [288] TRACE : ^[[37mURL_DOWNLOADER (get_data_to_file) : Downloading to prefs/temp/34d0cfc67e14006ae4919bbad6fcf644^[[0m ^[[90m10:40:05 [288] DEBUG : ^[[37mURL_DOWNLOADER (get_final_info) : .. Download Success^[[0m ^[[90m10:40:05 [288] DEBUG : ^[[37mBITS (find_executable) : Looking for executable program convert^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mBITS (find_executable) : program is /usr/bin/convert^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (construct) : Construct Image Type is "image/png"^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (checkImage) : Check Image type is image/png^[[0m ^[[90m10:40:06 [288] LOG : ^[[37mALBUMIMAGE (saveImage) : Creating file albumart/small/34d0cfc67e14006ae4919bbad6fcf644.png^[[0m ^[[90m10:40:06 [288] TRACE : ^[[37mIMAGEHANDLER (resizeToWidth) : Resizing to width 100^[[0m ^[[90m10:40:06 [288] TRACE : ^[[37mIMAGEMAGICK (get_image_dimensions) : Dimensions are 300 x 300^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Command is convert "prefs/temp/34d0cfc67e14006ae4919bbad6fcf644" -quality 95 -resize 100 "albumart/small/34d0cfc67e14006ae4919bbad6fcf644.png"^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Final line of output was ^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Return Value was 0^[[0m ^[[90m10:40:06 [288] LOG : ^[[37mALBUMIMAGE (saveImage) : Creating file albumart/medium/34d0cfc67e14006ae4919bbad6fcf644.png^[[0m ^[[90m10:40:06 [288] TRACE : ^[[37mIMAGEHANDLER (resizeToWidth) : Resizing to width 400^[[0m ^[[90m10:40:06 [288] TRACE : ^[[37mIMAGEMAGICK (get_image_dimensions) : Dimensions are 300 x 300^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (resizeToWidth) : Not resizing as requested size is larger than image^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Command is convert "prefs/temp/34d0cfc67e14006ae4919bbad6fcf644" -quality 95 -resize 100 "albumart/medium/34d0cfc67e14006ae4919bbad6fcf644.png"^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Final line of output was ^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Return Value was 0^[[0m ^[[90m10:40:06 [288] LOG : ^[[37mALBUMIMAGE (saveImage) : Creating file albumart/asdownloaded/34d0cfc67e14006ae4919bbad6fcf644.png^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Command is convert "prefs/temp/34d0cfc67e14006ae4919bbad6fcf644" -quality 95 "albumart/asdownloaded/34d0cfc67e14006ae4919bbad6fcf644.png"^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Final line of output was ^[[0m ^[[90m10:40:06 [288] DEBUG : ^[[37mIMAGEMAGICK (save) : Return Value was 0^[[0m ^[[90m10:40:06 [288] LOG : ^[[37mBACKEND (update_image_db) : Database Image URL Updated^[[0m ^[[90m10:40:06 [288] MARK : ^[[37mGETALBUMCOVER : --------------------------------------------^[[0m

tkgafs commented 2 years ago

Sorry I expected code to be formatted

file rompr/util_classes/imagefunctions.class.php line number 29

                    $albumpath = self::munge_filepath($albumpath);
                    logger::log("LOCAL IMAGE SCAN", "after munge albumpath is ",$albumpath);

// commenting out next line // $result = array_merge($result, self::get_images($albumpath)); // logger::log("LOCAL IMAGE SCAN", "IN IF result is ",$result);

fatg3erman commented 2 years ago

Commenting out that line makes sense because now it's not looking for local or embedded images at all, and yes it's getting one from Last.FM instead.

Thanks for sharing the folder, I'll take a look.

fatg3erman commented 2 years ago

Well, strange but I was right about the cause.

I'm not able to trap the error easily but I downloaded a newer version of getID3 and that doesn't crash and now it works. I'll do a new release with that version in it soon. Thanks for helping with the problem.