arkq / cmusfm

Last.fm standalone scrobbler for the cmus music player
GNU General Public License v3.0
234 stars 5 forks source link

Doesn't show album art images in popup notification when listening to disc image using *.cue file #45

Closed andgera closed 2 years ago

andgera commented 2 years ago

:face_exhaling: Doesn't show album art images in popup notification when listening to disc image using *.cue file.

cmus

music folder contents

$ ls -1  
cover.jpg   
'Purcell - King Arthur - CD1.cue'  
'Purcell - King Arthur - CD1.flac'  
'Purcell - King Arthur - CD1.log'  

my cmusfm.conf

$cat cmusfm.conf
# authentication
user = "user"
key = "key"

# regular expressions for name parsers
format-localfile = "^(?A.+) - (?T.+)\.[^.]+$"
format-shoutcast = "^(?A.+) - (?T.+)$"
format-coverfile = "^(cover|folder|front)\.jpg$"

now-playing-localfile = "yes"
now-playing-shoutcast = "yes"
submit-localfile = "yes"
submit-shoutcast = "yes"
notification = "yes"

# scrobbling service
service-api-url = "https://ws.audioscrobbler.com/2.0/"
service-auth-url = "https://www.last.fm/api/auth"

cover info

$ mediainfo cover.jpg
General
Complete name: cover.jpg
Format: JPEG
File size: 60.5 KiB

Image
Format: JPEG
Width: 600 pixels
Height: 535 pixels
Color space: YUV
Chroma subsampling: 4:2:0
Bit depth: 8 bits
Compression mode: Lossy
Stream size : 60.5 KiB (100%)

my cmusfm server

DEBUG ../../src/server.c:318: Starting server
DEBUG ../../src/server.c:357: Entering server main loop
DEBUG ../../src/server.c:365: New client accepted: 5
DEBUG ../../src/server.c:365: New client accepted: 6
DEBUG ../../src/server.c:139: Payload: Vox Luminis, Lionel Meunier - Purcell - King Arthur - CD1 - 1. First Music: Overture (152s)
DEBUG ../../src/server.c:143: Location: cue:///home/andrey/Music/Alpha 430 - Purcell - King Arthur - Vox Luminis, Meunier - 2018/CD1/Purcell - King Arthur - CD1.cue/1
DEBUG ../../src/server.c:147: Server hiccup test (5s)
DEBUG ../../src/libscrobbler2.c:391: Session validation wrapper
DEBUG ../../src/libscrobbler2.c:352: Now playing: 0
DEBUG ../../src/libscrobbler2.c:353: Payload:  - (null) ((null)) - 0.  (0s)
DEBUG ../../src/libscrobbler2.c:205: Signature data: api_key_private_aartistmethodtrack.updateNowPlayingskxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtrack02private
DEBUG ../../src/libscrobbler2.c:259: Request: api_key=privatea&artist=&method=track.updateNowPlaying&sk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&track=&api_sig=private
DEBUG ../../src/libscrobbler2.c:70: Read: size: 160, body: <?xml version="1.0" encoding="UTF-8"?>
<lfm status="failed">
  <error code="6">Invalid parameters - Your request is missing a required parameter</error>
</lfm>

DEBUG ../../src/libscrobbler2.c:130: Check: status: 0, body: <?xml version="1.0" encoding="UTF-8"?>
<lfm status="failed">
  <error code="6">Invalid parameters - Your request is missing a required parameter</error>
</lfm>

DEBUG ../../src/libscrobbler2.c:373: Now playing status: 3
DEBUG ../../src/cache.c:159: Cache submit
DEBUG ../../src/utils.c:126: Get cover (case-insensitive): ^(cover|folder|front)\.jpg$
DEBUG ../../src/libscrobbler2.c:382: Now playing wrapper
DEBUG ../../src/libscrobbler2.c:352: Now playing: 0
DEBUG ../../src/libscrobbler2.c:353: Payload: Vox Luminis, Lionel Meunier - Purcell - King Arthur - CD1 (Vox Luminis, Lionel Meunier) - 1. First Music: Overture (152s)
DEBUG ../../src/libscrobbler2.c:205: Signature data: albumPurcell - King Arthur - CD1albumArtistVox Luminis, Lionel Meunierapi_key_privateaartistVox Luminis, Lionel Meunierduration152methodtrack.updateNowPlayingskxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtrackFirst Music: OverturetrackNumberprivate
DEBUG ../../src/libscrobbler2.c:259: Request: album=Purcell%20-%20King%20Arthur%20-%20CD1&albumArtist=Vox%20Luminis%2C%20Lionel%20Meunier&api_key=privatea&artist=Vox%20Luminis%2C%20Lionel%20Meunier&duration=152&method=track.updateNowPlaying&sk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&track=First%20Music%3A%20Overture&trackNumber=1&api_sig=private
DEBUG ../../src/libscrobbler2.c:70: Read: size: 394, body: <?xml version="1.0" encoding="UTF-8"?>
<lfm status="ok">
  <nowplaying>
    <track corrected="0">First Music: Overture</track>
    <artist corrected="0">Vox Luminis, Lionel Meunier</artist>
    <album corrected="0">Purcell - King Arthur - CD1</album>
    <albumArtist corrected="0">Vox Luminis, Lionel Meunier</albumArtist>
    <ignoredMessage code="0"></ignoredMessage>
  </nowplaying>
</lfm>

DEBUG ../../src/libscrobbler2.c:130: Check: status: 0, body: <?xml version="1.0" encoding="UTF-8"?>
<lfm status="ok">
  <nowplaying>
    <track corrected="0">First Music: Overture</track>
    <artist corrected="0">Vox Luminis, Lionel Meunier</artist>
    <album corrected="0">Purcell - King Arthur - CD1</album>
    <albumArtist corrected="0">Vox Luminis, Lionel Meunier</albumArtist>
    <ignoredMessage code="0"></ignoredMessage>
  </nowplaying>
</lfm>

DEBUG ../../src/libscrobbler2.c:373: Now playing status: 0
^CDEBUG ../../src/server.c:302: Stopping server
andgera commented 2 years ago

I understand that cmusfm cannot find the file with the image, because when playing * .cue

DEBUG ../../src/server.c:143: Location: cue:///home/andrey/Music/Alpha 430 - Purcell - King Arthur - Vox Luminis, Meunier - 2018/CD1/Purcell - King Arthur - CD1.cue/1
....
....
DEBUG ../../src/utils.c:126: Get cover (case-insensitive): ^(cover|folder|front)\.jpg$
DEBUG ../../src/libscrobbler2.c:382: Now playing wrapper
DEBUG ../../src/libscrobbler2.c:352: Now playing: 0

and when playing individual flac files

DEBUG ../../src/server.c:143: Location: /home/andrey/Music/New/Hugh Laurie/Hugh Laurie - 2011 - Let Them Talk- Photobook/01 - St. James Infirmary.flac

....
....
DEBUG ../../src/utils.c:126: Get cover (case-insensitive): ^(cover|folder|front)\.jpg$
DEBUG ../../src/utils.c:151: Cover lookup: 02 - You Don't Know My Mind.flac
DEBUG ../../src/utils.c:151: Cover lookup: 08 - The Whale Has Swallowed Me.flac
DEBUG ../../src/utils.c:151: Cover lookup: 07 - Swanee River.flac
DEBUG ../../src/utils.c:151: Cover lookup: 13 - They're Red Hot.flac
DEBUG ../../src/utils.c:151: Cover lookup: 03 - Six Cold Feet.flac
DEBUG ../../src/utils.c:151: Cover lookup: 06 - After You've Gone.flac
DEBUG ../../src/utils.c:151: Cover lookup: 16 - Guess I'm a Fool.flac
DEBUG ../../src/utils.c:151: Cover lookup: 18 - Lowdown, Worried and Blue.flac
DEBUG ../../src/utils.c:151: Cover lookup: Let Them Talk- Photobook.cue
DEBUG ../../src/utils.c:151: Cover lookup: 11 - Tipitina.flac
DEBUG ../../src/utils.c:151: Cover lookup: 04 - Buddy Bolden's Blues.flac
DEBUG ../../src/utils.c:151: Cover lookup: 05 - Battle of Jericho.flac
DEBUG ../../src/utils.c:151: Cover lookup: 17 - It Ain't Necessarily So.flac
DEBUG ../../src/utils.c:151: Cover lookup: Hugh Laurie - Let Them Talk - Photobook.log
DEBUG ../../src/utils.c:151: Cover lookup: cover.jpg
DEBUG ../../src/utils.c:164: Cover: /home/andrey/Music/New/Hugh Laurie/Hugh Laurie - 2011 - Let Them Talk- Photobook/cover.jpg

If so, what can be done about it?

arkq commented 2 years ago

Without some changes in cmusfm I'm afraid that it will not be possible to display cover files... sorry. The simplest patch would be to check for the "cue" scheme and preprocess file location accordingly (in the cover lookup code). However, right now I've got no much time for coding in my opensource projects. You can propose a PR, though :)

andgera commented 2 years ago

Add