From b6033e9678a83db65a6efb6c32ad6a9cb2efab1a Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Sun, 2 Feb 2020 14:41:56 -0500 Subject: [PATCH] 2020-02-02 Fred Gleason * Added a 'libcoverart' dependency. * Added support for displaying cover art in the MusicBrainz release chooser. --- ChangeLog | 4 + INSTALL | 4 + configure.ac | 5 +- icons/Makefile.am | 2 + icons/cover_art_default-60x60.xcf | Bin 0 -> 6531 bytes icons/cover_art_default-60x60.xpm | 208 ++++++++++++++++++++++++++++++ lib/librd_cs.ts | 4 + lib/librd_de.ts | 4 + lib/librd_es.ts | 4 + lib/librd_fr.ts | 4 + lib/librd_nb.ts | 4 + lib/librd_nn.ts | 4 + lib/librd_pt_BR.ts | 4 + lib/rddisclookup.cpp | 3 +- lib/rdmblookup.cpp | 132 ++++++++++++++++++- lib/rdmblookup.h | 8 ++ 16 files changed, 389 insertions(+), 5 deletions(-) create mode 100644 icons/cover_art_default-60x60.xcf create mode 100644 icons/cover_art_default-60x60.xpm diff --git a/ChangeLog b/ChangeLog index 15c55af1..115541ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19477,3 +19477,7 @@ * Added support for saving Label data from MusicBrainz releases. 2020-02-02 Fred Gleason * Added support for reading ISRCs from MusicBrainz. +2020-02-02 Fred Gleason + * Added a 'libcoverart' dependency. + * Added support for displaying cover art in the MusicBrainz release + chooser. diff --git a/INSTALL b/INSTALL index 7ad77fab..cfd1ac8e 100644 --- a/INSTALL +++ b/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/ diff --git a/configure.ac b/configure.ac index 52a21d3b..74633adb 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/icons/Makefile.am b/icons/Makefile.am index 85302ed6..c484ca7b 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -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\ diff --git a/icons/cover_art_default-60x60.xcf b/icons/cover_art_default-60x60.xcf new file mode 100644 index 0000000000000000000000000000000000000000..f5d2e01b06b68a29f09cc8555d1969a3f801418f GIT binary patch literal 6531 zcmeHLZ){uD6+idAXFIkN$4Qgah5UI5pazhmR+PVDNKhE+v`t7uLP9|0B+t$(j@{WW zkPM0XBjwA6hTu~X+Ei`Ihp9pZZQ7WkZbL8E17E^nFTV&0y-J~o=oO%(IRk~ykw=~8YyW9}H+p{`Acox#@i5FOt{w7GA7 zJHeu}<^7onyO1+?Hgy4<+YAh_^i08aOuH~KWtCaJn9Y_g=aPXeeI?{0my2>7f=j%D zh@NY%aNmKE#^9*Nb{C(pO6J(u7#5`Qge#1}3Gy)70-Cv_0gW5=Z=hov==cV@eFNRG zf$jv&=dvD_jbN}ozBU#I7sQW&`B`?XStp&(%vmMo<1FtOWy~B=PCQchY0-J4aQ71# zJD(ZPTO){8wphUS&oYH_bCoXJzpyUL2lFV@kKlfL*2;76GX=-aAD)Yr?UM1vBrIAotBe`;HpfH&b@(?3|gmvJRxji?iwJ;-rNq zYS!Y)W#CDB5;ec;wq{lO=#*vWrW|wE&6mTfgf4k8Wy1|rpz?v^7F_y5Ks2iX@z)nG z$MjEleSn@Lxhgd&muNdxPe{4C?7AS`hD6q+D}`L0mo9-MUbv@LFv~SclIu!5D6h+mQ(!=p|K5Aoqf#AplaYv#KVrdR)Q;RtuAB^U{OB z04*JdF?Cn^b}LDS>hKk;;8jo^5V7;VeV@tGG)Op*s0ve5Bo=u8fEcFQk|caW#HMNF zf{qc~tx-ZPzOlh-uH1;y$5lBmPY1Dvtu7ym4=H*DNm^gwB`cSwpy;A(APIit5uLR) zx$H}5bPhDq@EP*Tu5nht;hvD5@IDHXaUQ|+>b`_e!+ff-1m{UboO3AXq^zm@xbk9E z1`<9E9cKa^NSzMb8f=LxIbq18Cf5RfrrkQvD}fhCB@+2cs|H&&sOr2`gRSpDiJu|= z&)!gc$3X0tKTp-~)wmHu9*ub4vqX;{q(AI__(huHMtmrB zf*Wz5=&ln(eG8A#ee=i0==Q%2;U`$?Ei~e$yo<;7%#)ZZ08-Xv4r3a2Mpgj1C=N;iTY%I~SyPS$|wGw3LmVeGv zd_xuV6(IWkzbn3R@l#QBVH`&^yj}@RI$S*hJ4~u2-zR*~Y+)F>Flcn)hukr4wpVWa zx%B)d8&P`anpd?qqd}NG@AMQOiVwOl=+xqG&cD8umns9?grE5lmG=5k=hoN%cDFBp zCJZ`Nzc2pmi$MI0fWr-);U@fspNOub%bvH(m+@HR81Ja z1@8<7ZWO;KGx2z?RGcYH^78w7XJB1?ZT8O4e1E}q;$>#S)ifC|n~9@7)Wi~S9e&_9 z8cs9B5EHlaG|E$gr)z7uIXMp)MbbzpZ8k^uCt zSq8`zBn%-n$R@yY2Oq2ys%Zcc{1a>o!-LolficO8E}r7FDl{Y176weprT|_MdL)+Y zOoV~MI1P`xCfdOr?%dYj8`T4oV|<7~4IGN9Uln?^r$5zh1TtMz7yizgFyh@?Vok9w z(tyXQDvY*h++p8Z&WVG=$R?AwWVj7&5Vp zsih0{VRDUbtaQ=K=0>R@B7@Wo<`GyP-;Ur2e=EWVXze#(Qx`p0w82CzHp*{?orvTX zsERNY8Dc0&>o9>m>;yjxuN(N^gIZ(9Frb{{*2bpdy%i~f2ynJBsg4)IWjVoiauL95 z0W~l)LI@h_!FL#e1V^xe=ma7NBub1+0DLUf!IQ}o{s0NQv0$P3DY}*U#4SMhSkdh> zv#D&6O1&xqE+l5S7WV}Fz7Fnj{cXokxxN{aFqN&w8<8-=VfOVVHaXlD=EHV^bzKXo z!nz4GXAp2N$bJf`;Hm<>muUB--AQ zNVG?lwj@^?*tgR8uD)#pgTwu)WJj>0`SH|R4`uK$wI0gWL&*!ECQ%2uarb;>I{ G<^KRyg(r>x literal 0 HcmV?d00001 diff --git a/icons/cover_art_default-60x60.xpm b/icons/cover_art_default-60x60.xpm new file mode 100644 index 00000000..903c5183 --- /dev/null +++ b/icons/cover_art_default-60x60.xpm @@ -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.% # + + . . . . . . . . . . . . . . . . . . + + + . . . . . . . . . . . . . . . . . . . . + . . . . "}; diff --git a/lib/librd_cs.ts b/lib/librd_cs.ts index f2e7f150..3ecfeaea 100644 --- a/lib/librd_cs.ts +++ b/lib/librd_cs.ts @@ -2446,6 +2446,10 @@ Bitte Kofiguration prüfen und erneut versuchen. Lookup + + Resource Not Found + + RDPanelButton diff --git a/lib/librd_de.ts b/lib/librd_de.ts index a1560461..21328ccf 100644 --- a/lib/librd_de.ts +++ b/lib/librd_de.ts @@ -2441,6 +2441,10 @@ Bitte Kofiguration prüfen und erneut versuchen. Lookup + + Resource Not Found + + RDPanelButton diff --git a/lib/librd_es.ts b/lib/librd_es.ts index 9c1db2ee..fbe85532 100644 --- a/lib/librd_es.ts +++ b/lib/librd_es.ts @@ -2431,6 +2431,10 @@ Do you still want to proceed? Lookup + + Resource Not Found + + RDPanelButton diff --git a/lib/librd_fr.ts b/lib/librd_fr.ts index 8cab9296..31fa3ad4 100644 --- a/lib/librd_fr.ts +++ b/lib/librd_fr.ts @@ -1973,6 +1973,10 @@ Do you want to overwrite it? Lookup + + Resource Not Found + + RDPanelButton diff --git a/lib/librd_nb.ts b/lib/librd_nb.ts index 93a59fb7..aca8e654 100644 --- a/lib/librd_nb.ts +++ b/lib/librd_nb.ts @@ -2412,6 +2412,10 @@ Sjekk eksportoppsettet ditt og prøv att. Lookup + + Resource Not Found + + RDPanelButton diff --git a/lib/librd_nn.ts b/lib/librd_nn.ts index 93a59fb7..aca8e654 100644 --- a/lib/librd_nn.ts +++ b/lib/librd_nn.ts @@ -2412,6 +2412,10 @@ Sjekk eksportoppsettet ditt og prøv att. Lookup + + Resource Not Found + + RDPanelButton diff --git a/lib/librd_pt_BR.ts b/lib/librd_pt_BR.ts index eab5c6ca..6a621b69 100644 --- a/lib/librd_pt_BR.ts +++ b/lib/librd_pt_BR.ts @@ -2446,6 +2446,10 @@ Por Favor, cheque suas configurações e tenbte outra vez. Lookup + + Resource Not Found + + RDPanelButton diff --git a/lib/rddisclookup.cpp b/lib/rddisclookup.cpp index 5b131e8c..02023ca6 100644 --- a/lib/rddisclookup.cpp +++ b/lib/rddisclookup.cpp @@ -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); diff --git a/lib/rdmblookup.cpp b/lib/rdmblookup.cpp index 9451c93d..fcaa9d95 100644 --- a/lib/rdmblookup.cpp +++ b/lib/rdmblookup.cpp @@ -19,6 +19,13 @@ // // +#include + +#include + +#include +#include + #include #include #include @@ -37,11 +44,16 @@ #include #include -#include +#include +#include +#include +#include +#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;ipath()+"/"+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 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; +} diff --git a/lib/rdmblookup.h b/lib/rdmblookup.h index 7805aca4..50da97ca 100644 --- a/lib/rdmblookup.h +++ b/lib/rdmblookup.h @@ -22,6 +22,9 @@ #ifndef RDMBLOOKUP_H #define RDMBLOOKUP_H +#include +#include + #include #include @@ -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