mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-30 23:49:32 +02:00
2020-02-02 Fred Gleason <fredg@paravelsystems.com>
* Added a 'libcoverart' dependency. * Added support for displaying cover art in the MusicBrainz release chooser.
This commit is contained in:
parent
acec6be323
commit
b6033e9678
@ -19477,3 +19477,7 @@
|
||||
* Added support for saving Label data from MusicBrainz releases.
|
||||
2020-02-02 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added support for reading ISRCs from MusicBrainz.
|
||||
2020-02-02 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'libcoverart' dependency.
|
||||
* Added support for displaying cover art in the MusicBrainz release
|
||||
chooser.
|
||||
|
4
INSTALL
4
INSTALL
@ -18,6 +18,10 @@ LibCurl, v7.19.0 or later
|
||||
A client-side URL transfer library. Included with most distros, or
|
||||
available at: http://curl.haxx.se/libcurl/.
|
||||
|
||||
LibCoverArt, v1.0.0 or later
|
||||
A library for accessing the MusicBrainz Cover Art Archive.
|
||||
Available at https://musicbrainz.org/
|
||||
|
||||
LibDiscId, v0.6.2 or later
|
||||
A library for reading the attributes of audio CDs.
|
||||
Available at https://musicbrainz.org/
|
||||
|
@ -234,9 +234,10 @@ else
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for MusicBrainz support libraries (libdiscid and libmusicbrainz)
|
||||
# Check for MusicBrainz support libraries
|
||||
# (libdiscid, libmusicbrainz and libcoverart)
|
||||
#
|
||||
PKG_CHECK_MODULES(MUSICBRAINZ,libdiscid libmusicbrainz5,,[AC_MSG_ERROR([*** LibMusicBrainz not found ***])])
|
||||
PKG_CHECK_MODULES(MUSICBRAINZ,libdiscid libmusicbrainz5 libcoverart,,[AC_MSG_ERROR([*** LibMusicBrainz not found ***])])
|
||||
|
||||
#
|
||||
# Check for Id3Lib
|
||||
|
@ -270,6 +270,8 @@ EXTRA_DIST = admin.xpm\
|
||||
chain.png\
|
||||
chain.xpm\
|
||||
checkmark.xpm\
|
||||
cover_art_default-60x60.xcf\
|
||||
cover_art_default-60x60.xpm\
|
||||
download.xpm\
|
||||
ex.xpm\
|
||||
fillstart.xpm\
|
||||
|
BIN
icons/cover_art_default-60x60.xcf
Normal file
BIN
icons/cover_art_default-60x60.xcf
Normal file
Binary file not shown.
208
icons/cover_art_default-60x60.xpm
Normal file
208
icons/cover_art_default-60x60.xpm
Normal file
@ -0,0 +1,208 @@
|
||||
/* XPM */
|
||||
static const char * cover_art_default_60x60_xpm[] = {
|
||||
"60 60 145 2",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #010101",
|
||||
"@ c #020202",
|
||||
"# c #030303",
|
||||
"$ c #040404",
|
||||
"% c #060606",
|
||||
"& c #191919",
|
||||
"* c #A4A4A4",
|
||||
"= c #E5E5E5",
|
||||
"- c #EAEAEA",
|
||||
"; c #9D9D9D",
|
||||
"> c #0F0F0F",
|
||||
", c #D2D2D2",
|
||||
"' c #888888",
|
||||
") c #181818",
|
||||
"! c #111111",
|
||||
"~ c #5E5E5E",
|
||||
"{ c #5D5D5D",
|
||||
"] c #050505",
|
||||
"^ c #080808",
|
||||
"/ c #454545",
|
||||
"( c #CCCCCC",
|
||||
"_ c #7A7A7A",
|
||||
": c #E7E7E7",
|
||||
"< c #ECECEC",
|
||||
"[ c #929292",
|
||||
"} c #7F7F7F",
|
||||
"| c #727272",
|
||||
"1 c #696969",
|
||||
"2 c #6B6B6B",
|
||||
"3 c #E0E0E0",
|
||||
"4 c #F1F1F1",
|
||||
"5 c #A6A6A6",
|
||||
"6 c #070707",
|
||||
"7 c #171717",
|
||||
"8 c #D3D3D3",
|
||||
"9 c #F2F2F2",
|
||||
"0 c #212121",
|
||||
"a c #0A0A0A",
|
||||
"b c #101010",
|
||||
"c c #0E0E0E",
|
||||
"d c #656565",
|
||||
"e c #3C3C3C",
|
||||
"f c #D5D5D5",
|
||||
"g c #202020",
|
||||
"h c #161616",
|
||||
"i c #BFBFBF",
|
||||
"j c #5C5C5C",
|
||||
"k c #1A1A1A",
|
||||
"l c #DCDCDC",
|
||||
"m c #0C0C0C",
|
||||
"n c #363636",
|
||||
"o c #C7C7C7",
|
||||
"p c #1C1C1C",
|
||||
"q c #090909",
|
||||
"r c #8E8E8E",
|
||||
"s c #707070",
|
||||
"t c #FAFAFA",
|
||||
"u c #434343",
|
||||
"v c #151515",
|
||||
"w c #898989",
|
||||
"x c #6A6A6A",
|
||||
"y c #ADADAD",
|
||||
"z c #424242",
|
||||
"A c #595959",
|
||||
"B c #969696",
|
||||
"C c #676767",
|
||||
"D c #FFFFFF",
|
||||
"E c #9C9C9C",
|
||||
"F c #D4D4D4",
|
||||
"G c #141414",
|
||||
"H c #3D3D3D",
|
||||
"I c #1E1E1E",
|
||||
"J c #A9A9A9",
|
||||
"K c #C1C1C1",
|
||||
"L c #2D2D2D",
|
||||
"M c #383838",
|
||||
"N c #C2C2C2",
|
||||
"O c #CFCFCF",
|
||||
"P c #0B0B0B",
|
||||
"Q c #121212",
|
||||
"R c #131313",
|
||||
"S c #E6E6E6",
|
||||
"T c #EBEBEB",
|
||||
"U c #7D7D7D",
|
||||
"V c #E8E8E8",
|
||||
"W c #EDEDED",
|
||||
"X c #959595",
|
||||
"Y c #D6D6D6",
|
||||
"Z c #C3C3C3",
|
||||
"` c #686868",
|
||||
" . c #DDDDDD",
|
||||
".. c #FCFCFC",
|
||||
"+. c #737373",
|
||||
"@. c #272727",
|
||||
"#. c #262626",
|
||||
"$. c #2A2A2A",
|
||||
"%. c #EFEFEF",
|
||||
"&. c #4F4F4F",
|
||||
"*. c #AFAFAF",
|
||||
"=. c #BBBBBB",
|
||||
"-. c #282828",
|
||||
";. c #1F1F1F",
|
||||
">. c #353535",
|
||||
",. c #C8C8C8",
|
||||
"'. c #747474",
|
||||
"). c #A7A7A7",
|
||||
"!. c #CACACA",
|
||||
"~. c #E2E2E2",
|
||||
"{. c #F8F8F8",
|
||||
"]. c #F7F7F7",
|
||||
"^. c #D7D7D7",
|
||||
"/. c #575757",
|
||||
"(. c #BABABA",
|
||||
"_. c #949494",
|
||||
":. c #222222",
|
||||
"<. c #B4B4B4",
|
||||
"[. c #A1A1A1",
|
||||
"}. c #F0F0F0",
|
||||
"|. c #BCBCBC",
|
||||
"1. c #878787",
|
||||
"2. c #494949",
|
||||
"3. c #1B1B1B",
|
||||
"4. c #D0D0D0",
|
||||
"5. c #444444",
|
||||
"6. c #C4C4C4",
|
||||
"7. c #B3B3B3",
|
||||
"8. c #333333",
|
||||
"9. c #D9D9D9",
|
||||
"0. c #292929",
|
||||
"a. c #535353",
|
||||
"b. c #B5B5B5",
|
||||
"c. c #373737",
|
||||
"d. c #B8B8B8",
|
||||
"e. c #484848",
|
||||
"f. c #6E6E6E",
|
||||
"g. c #909090",
|
||||
"h. c #C9C9C9",
|
||||
"i. c #F3F3F3",
|
||||
"j. c #B7B7B7",
|
||||
"k. c #A2A2A2",
|
||||
"l. c #BDBDBD",
|
||||
"m. c #0D0D0D",
|
||||
"n. c #1D1D1D",
|
||||
". . . . . . . . . . . . + . . . . . . . . . + + + + + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + + + . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + @ # + + . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + @ @ $ # + + . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + + @ # $ % # @ + . . . . . . . . . . . . . . . + + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + + + @ # # $ # + + . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . + + + + + + @ + + + . . . . . . . . . . . . . . . + + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + + + . + . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . & * = - ; > . . . . . . . . . . . . . . . . . . . + + @ @ @ @ @ @ + + . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . $ , ' ) ! ~ { . . . . . . + . . . . . . . . . . . . . + @ $ ] ^ % ] @ + . . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . / ( . . . . . . _ : < [ + } | . . ' 1 . 2 3 4 5 6 7 8 ; 9 0 a b > c % @ + . . . . . . . . . . . . . . . . @ ",
|
||||
". . . . . . d * . . . . . e f g h i j k f . ] l m n o p q r s 7 t u @ % > & p v q # + . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . / ( . . . . + 1 w . . x ' @ y z A B . C D D D D E 7 F . + # q G p ) m $ + . . . . . . . . . . . . . . . . @ ",
|
||||
". . . . . . $ , ' ) ! ~ { H F I v i { + / J K L . M N I . . . 7 O . . + $ P Q R a # + . . . . . . . . . . . . . . . . + ",
|
||||
". . . . . . . & * S T E > . U V W X @ @ @ Y Z + . . ` ...D C 7 O . . . + $ ^ q 6 $ + . . . . . . . . . . . . . . . . @ ",
|
||||
". . . . . . . . . . . . . . . . . . . + # # + + . . . . . . . . . . . . . + @ # # # + . . . . . . . . . . . . . . . . @ ",
|
||||
". . . . . . . . . . . . . . . . . . . @ # # @ + . . . . . . . . . . . . . . . + @ + . . . . . . . . . . . . . . . . . # ",
|
||||
". . . . . . . . . . . . . . . . . . . + @ # + + . . . . . . . . . . . . . . . + + + . . . . . . . . . . . . . . . . + ] ",
|
||||
". . . . . . . . . . . . . . . . . . . + + # + + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + a ",
|
||||
". . . . . . . . . . . . . . . . . . . + + @ + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $ Q ",
|
||||
". . . . . . . . . . . . . . . . . . . + + + + . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . + 6 I ",
|
||||
". . . . . . # D X . . +.} . . . . . . R 8 + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ P @.",
|
||||
". . . . . . # 9 8 #.. +.} . . . . . . R 8 + + . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . + + @ m $.",
|
||||
". . . . . . # %.&.*.. +.} . _ : < [ + =.D D *.+ . . . . . . . . . . . . . . . . . . . . . + + . . . . . . . . . + @ a -.",
|
||||
". . + . . . # %.. K H +.} e f g h i j R 8 + + + + . . . . . . . . . . . . . . . . . . . . + + + . . . . . . . . + @ 6 ;.",
|
||||
". . + . . . # %.. >.,.'.} 1 w . . x ' R 8 + @ # @ + + . . . . . . . . . . . . . . . . . + + + + . . . . . . . . + + $ h ",
|
||||
". . + + . . # %.. . ).!.} H F I v i { a ~.q @ $ $ @ + . . . . . . . . . . . . . . . . . . + + + . . . . . . . . . + @ m ",
|
||||
". . + + + . # %.. . g {.} . U V W X @ . * ].*.$ $ # + + . . . . . . . . . . . . . . . . . . + + . . . . . . . . . + + 6 ",
|
||||
". + + + @ + . . . . . . . . . . . . . . . . + # # # + + . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . + $ ",
|
||||
"+ + @ + @ + . . . . . . . . . . . . . . . . . + @ @ + . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . + @ ",
|
||||
"+ + + @ + . . . . . . . . . . . . . . . . . . . + + + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". + + + + . . . + . . . . . . . . . . . . . . . + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + ",
|
||||
". . . + + . . . + + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
". . . + . . . . @ + + . . . . . . . . . . . . . > ^.. > ^.. . . . . . . 7 O . . . . > ^.. . . . . . . . . . . . . . . . ",
|
||||
". . . . . . . . /...L + . . . . . . . . . . . . . . . > ^.. . . . . . . 7 O . . . . > ^.. . . . . . . . . . . . . . . . ",
|
||||
". . . . . . . + (.| _.+ + . . . . . . . . . . . . . . > ^.. . . + . . . 7 O . . . . > ^.. . . . . . . . . . . . . . . . ",
|
||||
". . . . . . . :.<.] ( q } | . . ' 1 . D D = C . > ^.. > ^.. . D D = C . 7 8 [.}.|.h > ^.. . 2 3 4 5 ^ . . . . . . . . . ",
|
||||
". . . . . . . 1.2.@ | ~ k f . ] l m . . . 3.4.! > ^.. > ^.. . . . 3.4.! 7 t 5.a w B > ^.. n o p q r s + . . . . . . . . ",
|
||||
". . . . . . $ : D D D 6.. y z A B . b 7.4 D D 8.> ^.. > ^.. b 7.4 D D 8.7 9.. . 0.K > ^.. C D D D D E + + + . . . . . . ",
|
||||
". . . . . . a.E + + . 6.$.5.J K L . A b.G g ^.c.> ^.. > ^.. A b.G g ^.c.7 t z q 1.B > ^.. M N I . . + + @ + + . . . . . ",
|
||||
". . . . . . d.e.. . . f.g.. Y Z . . h h.i.j.|.c.> ^.. > ^.. h h.i.j.|.c.7 8 k.}.l.h > ^.. . ` ...D C # # # @ + . . . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + $ % % $ @ + . . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + $ % ^ % # + + . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + @ ] % ] @ + . . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + @ # # + + . . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . + + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + + + + . . . ",
|
||||
". . . . . . . . . . . . . . . . . . + + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
". . . . . . . . . . . . . . . . . . + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + + + + . . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + @ @ + . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
". . . . . + + + + . . . . . . . . . . . . . . . . . . . . . . @ @ # @ + . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
"+ + @ @ @ # # @ @ @ + . . . . . . . . . . . . . . . . . . . . + # @ + + . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
"] 6 q m m.c c m q % # + + . . . . . . . . . . . . . . . . . . + @ @ + . . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
"! h & n.I 0 p ) b m.% # + + . . . . . . . . . . . . . . . . . . + + + . . . . . . . . . . . . . . . . . . . . + . . . . "};
|
@ -2446,6 +2446,10 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<source>Lookup</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource Not Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
|
@ -2441,6 +2441,10 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<source>Lookup</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource Not Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
|
@ -2431,6 +2431,10 @@ Do you still want to proceed?</source>
|
||||
<source>Lookup</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource Not Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
|
@ -1973,6 +1973,10 @@ Do you want to overwrite it?</source>
|
||||
<source>Lookup</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource Not Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
|
@ -2412,6 +2412,10 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<source>Lookup</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource Not Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
|
@ -2412,6 +2412,10 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<source>Lookup</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource Not Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
|
@ -2446,6 +2446,10 @@ Por Favor, cheque suas configurações e tenbte outra vez.</translation>
|
||||
<source>Lookup</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Resource Not Found</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDPanelButton</name>
|
||||
|
@ -168,7 +168,8 @@ void RDDiscLookup::resizeEvent(QResizeEvent *e)
|
||||
|
||||
lookup_titles_label->setGeometry(15,2,w-30,20);
|
||||
|
||||
lookup_titles_box->setGeometry(10,24,w-20,40);
|
||||
lookup_titles_box->
|
||||
setGeometry(10,24,w-20,lookup_titles_box->sizeHint().height());
|
||||
|
||||
lookup_ok_button->setGeometry(w-180,h-60,80,50);
|
||||
lookup_cancel_button->setGeometry(w-90,h-60,80,50);
|
||||
|
@ -19,6 +19,13 @@
|
||||
//
|
||||
//
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <coverart/CoverArt.h>
|
||||
#include <coverart/HTTPFetch.h>
|
||||
|
||||
#include <musicbrainz5/Artist.h>
|
||||
#include <musicbrainz5/ArtistCredit.h>
|
||||
#include <musicbrainz5/Disc.h>
|
||||
@ -37,11 +44,16 @@
|
||||
#include <musicbrainz5/RelationListList.h>
|
||||
#include <musicbrainz5/Track.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <qdir.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qpixmapcache.h>
|
||||
|
||||
#include "rdconf.h"
|
||||
#include "rdmblookup.h"
|
||||
|
||||
#include "../icons/musicbrainz-159x25.xpm"
|
||||
#include "../icons/cover_art_default-60x60.xpm"
|
||||
|
||||
QString err_str="OK";
|
||||
RDDiscLookup::Result result_code=RDDiscLookup::ExactMatch;
|
||||
@ -51,6 +63,49 @@ RDMbLookup::RDMbLookup(const QString &caption,FILE *profile_msgs,
|
||||
: RDDiscLookup(caption,profile_msgs,parent)
|
||||
{
|
||||
setWindowTitle(caption+" - MusicBrainz "+tr("Lookup"));
|
||||
|
||||
cover_art_default_icon=new QIcon(cover_art_default_60x60_xpm);
|
||||
|
||||
titlesBox()->setIconSize(QSize(60,60));
|
||||
|
||||
char tempdir[PATH_MAX];
|
||||
|
||||
//
|
||||
// Create temporary directory
|
||||
//
|
||||
temp_directory=NULL;
|
||||
strncpy(tempdir,"/tmp",PATH_MAX);
|
||||
if(getenv("TEMP")!=NULL) {
|
||||
strncpy(tempdir,getenv("TEMP"),PATH_MAX);
|
||||
}
|
||||
strncat(tempdir,"/rivendell-XXXXXX",PATH_MAX-strlen(tempdir));
|
||||
if(mkdtemp(tempdir)==NULL) {
|
||||
rda->syslog(LOG_WARNING,"unable to create temporary directory [%s]",
|
||||
strerror(errno));
|
||||
}
|
||||
temp_directory=new QDir(tempdir);
|
||||
rda->syslog(LOG_DEBUG,
|
||||
"using working directory \"%s\" for cover art processing",
|
||||
(const char *)temp_directory->path().toUtf8());
|
||||
}
|
||||
|
||||
|
||||
RDMbLookup::~RDMbLookup()
|
||||
{
|
||||
QStringList files=temp_directory->entryList(QDir::Files);
|
||||
for(int i=0;i<files.size();i++) {
|
||||
unlink((temp_directory->path()+"/"+files[i]).toUtf8());
|
||||
}
|
||||
rmdir(temp_directory->path().toUtf8());
|
||||
rda->syslog(LOG_DEBUG,"deleted working directory \"%s\"",
|
||||
(const char *)temp_directory->path().toUtf8());
|
||||
delete temp_directory;
|
||||
}
|
||||
|
||||
|
||||
QSize RDMbLookup::sizeHint() const
|
||||
{
|
||||
return QSize(500,160);
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +167,7 @@ void RDMbLookup::lookupRecord()
|
||||
title+=" [UPC "+barcode+"]";
|
||||
}
|
||||
titlesKey()->push_back(QString::fromUtf8(release->Title().c_str()));
|
||||
titlesBox()->insertItem(titlesBox()->count(),title);
|
||||
titlesBox()->insertItem(titlesBox()->count(),GetReleaseCover(QString::fromUtf8(release->ID().c_str())),title);
|
||||
}
|
||||
if((index=exec())>=0) {
|
||||
result_code=ProcessRelease(releases->Item(index));
|
||||
@ -174,6 +229,16 @@ void RDMbLookup::lookupRecord()
|
||||
QString::fromUtf8(mbq.LastErrorMessage().c_str());
|
||||
result_code=RDDiscLookup::LookupError;
|
||||
}
|
||||
catch (MusicBrainz5::CResourceNotFoundError &err) {
|
||||
err_str=" "+tr("Resource Not Found")+"\n"+
|
||||
" "+tr("Last Result")+": "+\
|
||||
QString().sprintf("%d",mbq.LastResult())+"\n"+
|
||||
" "+tr("LastHTTPCode")+": "+
|
||||
QString().sprintf("%d",mbq.LastHTTPCode())+"\n"+
|
||||
" "+tr("LastErrorMessage")+": "+
|
||||
QString::fromUtf8(mbq.LastErrorMessage().c_str());
|
||||
result_code=RDDiscLookup::NoMatch;
|
||||
}
|
||||
emit lookupDone(result_code,err_str);
|
||||
}
|
||||
|
||||
@ -253,3 +318,66 @@ RDDiscLookup::Result RDMbLookup::ProcessRelease(MusicBrainz5::CRelease *release)
|
||||
}
|
||||
return RDDiscLookup::ExactMatch;
|
||||
}
|
||||
|
||||
|
||||
QIcon RDMbLookup::GetReleaseCover(const QString &mbid) const
|
||||
{
|
||||
CoverArtArchive::CCoverArt ca((QString("rivendell-")+VERSION).toStdString());
|
||||
err_str="";
|
||||
|
||||
try {
|
||||
QPixmap pix;
|
||||
QString key="$coverart-front-"+mbid;
|
||||
|
||||
if(QPixmapCache::find(key,&pix)) {
|
||||
return QIcon(pix);
|
||||
}
|
||||
|
||||
std::vector<unsigned char> image=ca.FetchFront(mbid.toStdString());
|
||||
if(image.size()) {
|
||||
std::stringstream filename;
|
||||
filename << temp_directory->path().toStdString() << "/" <<
|
||||
mbid.toStdString();
|
||||
|
||||
std::ofstream front(filename.str().c_str());
|
||||
front.write((const char *)&image[0],image.size());
|
||||
front.close();
|
||||
|
||||
pix=QPixmap(QString(filename.str().c_str()));
|
||||
unlink(QString::fromUtf8(filename.str().c_str()).toUtf8());
|
||||
if((pix.width()==0)||(pix.height()==0)) {
|
||||
return *cover_art_default_icon;
|
||||
}
|
||||
QPixmapCache::insert(key,pix);
|
||||
return QIcon(pix);
|
||||
}
|
||||
}
|
||||
|
||||
catch (CoverArtArchive::CConnectionError &err) {
|
||||
err_str="ConnectionError when downloading coverart ["+
|
||||
QString::fromUtf8(ca.LastErrorMessage().c_str())+"]";
|
||||
}
|
||||
catch (CoverArtArchive::CTimeoutError &err) {
|
||||
err_str="TimeoutError when downloading coverart ["+
|
||||
QString::fromUtf8(ca.LastErrorMessage().c_str())+"]";
|
||||
}
|
||||
catch (CoverArtArchive::CAuthenticationError &err) {
|
||||
err_str="AuthenticationError when downloading coverart ["+
|
||||
QString::fromUtf8(ca.LastErrorMessage().c_str())+"]";
|
||||
}
|
||||
catch (CoverArtArchive::CFetchError &err) {
|
||||
err_str="FetchError when downloading coverart ["+
|
||||
QString::fromUtf8(ca.LastErrorMessage().c_str())+"]";
|
||||
}
|
||||
catch (CoverArtArchive::CRequestError &err) {
|
||||
err_str="RequestError when downloading coverart ["+
|
||||
QString::fromUtf8(ca.LastErrorMessage().c_str())+"]";
|
||||
}
|
||||
catch (CoverArtArchive::CResourceNotFoundError &err) {
|
||||
}
|
||||
|
||||
if(!err_str.isEmpty()) {
|
||||
rda->syslog(LOG_WARNING,"%s",(const char *)err_str.toUtf8());
|
||||
}
|
||||
return *cover_art_default_icon;
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
#ifndef RDMBLOOKUP_H
|
||||
#define RDMBLOOKUP_H
|
||||
|
||||
#include <qdir.h>
|
||||
#include <qicon.h>
|
||||
|
||||
#include <musicbrainz5/Release.h>
|
||||
|
||||
#include <rddisclookup.h>
|
||||
@ -31,6 +34,8 @@ class RDMbLookup : public RDDiscLookup
|
||||
Q_OBJECT
|
||||
public:
|
||||
RDMbLookup(const QString &caption,FILE *profile_msgs,QWidget *parent=0);
|
||||
~RDMbLookup();
|
||||
QSize sizeHint() const;
|
||||
QString sourceName() const;
|
||||
QPixmap sourceLogo() const;
|
||||
QString sourceUrl() const;
|
||||
@ -40,6 +45,9 @@ class RDMbLookup : public RDDiscLookup
|
||||
|
||||
private:
|
||||
RDDiscLookup::Result ProcessRelease(MusicBrainz5::CRelease *release);
|
||||
QIcon GetReleaseCover(const QString &mbid) const;
|
||||
QIcon *cover_art_default_icon;
|
||||
QDir *temp_directory;
|
||||
};
|
||||
|
||||
#endif // RDMBLOOKUP_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user