View previous topic :: View next topic |
Author |
Message |
foreboy n00b
Joined: 08 Mar 2008 Posts: 0
|
Posted: Sat Mar 08, 2008 8:05 pm Post subject: here's a basic ebuild that works |
|
|
at least the hack links get deleted if you unmerge (amazonmp3-1.0.3-r1.ebuild):
Code: | # Distributed under the terms of the GNU General Public License v2
# be kind, give credit: initial, Paul Cifarelli <paul@cifarelli.net>
inherit eutils rpm
MY_PN="amazonmp3"
DESCRIPTION="Amazon mp3 downloader"
HOMEPAGE="http://www.amazon.com/gp/dmusic/help/amd.html?ie=UTF8&forceos=LINUX&ASIN=&isTrack="
SRC_URI="amazonmp3-1.0.3-1.fedora8.i386.rpm"
LICENSE="EUBL"
SLOT="0"
KEYWORDS="-* amd64 x86"
IUSE="X"
RESTRICT="strip test fetch"
RDEPEND="dev-cpp/glibmm dev-cpp/cairomm dev-cpp/gtkmm >=dev-libs/boost-1.34"
pkg_nofetch() {
einfo "Download the Amazon Downloader manually from Amazon's website at"
einfo ${HOMEPAGE}
einfo ""
einfo "Click \"I agree to the terms of use\" &"
einfo "Choose the Download now Fedora 8 button"
einfo ""
einfo "Then place the file ${SRC_URI}"
einfo "into ${DISTDIR} and restart the emerge."
}
pkg_setup() {
# This is a binary x86 package => ABI=x86
has_multilib_profile && ABI="x86"
}
src_unpack() {
rpm_src_unpack
}
src_install() {
mkdir -p ${D}/usr/bin
cp ${WORKDIR}/usr/bin/amazonmp3 ${D}/usr/bin
chmod +x ${D}/usr/bin
mkdir -p ${D}/usr/share/applications
cp ${WORKDIR}/usr/share/applications/amazonmp3.desktop ${D}/usr/share/applications
mkdir -p ${D}/usr/share/doc/amazonmp3
cp ${WORKDIR}/usr/share/doc/amazonmp3/help.html ${D}/usr/share/doc/amazonmp3
cp ${WORKDIR}/usr/share/doc/amazonmp3/license.html ${D}/usr/share/doc/amazonmp3
cp ${WORKDIR}/usr/share/doc/amazonmp3/releasenotes ${D}/usr/share/doc/amazonmp3
mkdir -p ${D}/usr/share/mime-info
cp ${WORKDIR}/usr/share/mime-info/amazonmp3.keys ${D}/usr/share/mime-info
cp ${WORKDIR}/usr/share/mime-info/amazonmp3.mime ${D}/usr/share/mime-info
mkdir -p ${D}/usr/share/mime/packages
cp ${WORKDIR}/usr/share/mime/packages/amazonmp3.xml ${D}/usr/share/mime/packages
mkdir -p ${D}/usr/share/mimelnk/audio
cp ${WORKDIR}/usr/share/mimelnk/audio/x-amzxml.desktop ${D}/usr/share/mimelnk/audio
mkdir -p ${D}/usr/share/pixmaps
cp ${WORKDIR}/usr/share/pixmaps/amazonmp3.png ${D}/usr/share/pixmaps
cd ${D}/usr/share/applications
domenu amazonmp3.desktop
dodir /usr/lib
cd ${D}/usr/lib
dosym libssl.so /usr/lib/libssl.so.6
dosym libcrypto.so /usr/lib/libcrypto.so.6
dosym libboost_date_time.so /usr/lib/libboost_date_time.so.3
dosym libboost_signals.so /usr/lib/libboost_signals.so.3
dosym libboost_iostreams.so /usr/lib/libboost_iostreams.so.3
dosym libboost_thread-mt.so /usr/lib/libboost_thread-mt.so.3
} |
|
|
Back to top |
|
|
ppurka Advocate
Joined: 26 Dec 2004 Posts: 3256
|
Posted: Sat Mar 08, 2008 11:37 pm Post subject: |
|
|
Excellent! So, now I won't have to write an ebuild
By the way, I didn't know that a function like rpm_src_unpack existed. _________________ emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/ |
|
Back to top |
|
|
foreboy n00b
Joined: 08 Mar 2008 Posts: 0
|
Posted: Sun Mar 09, 2008 3:29 pm Post subject: |
|
|
pkg_setup should probably be, for completeness,
Code: | pkg_setup() {
if ! built_with_use dev-cpp/gtkmm accessibility api-atkmm; then
eerror "You need to build dev-cpp/gtkmm with USE=accessibility api-atkmm enabled."
die "gtkmm without necessary use flags detected"
fi
# This is a binary x86 package => ABI=x86
has_multilib_profile && ABI="x86"
}
|
BTW this was modeled on the realplayer ebuild, which is where I first saw rpm_src_unpack |
|
Back to top |
|
|
alistair Retired Dev
Joined: 15 Jul 2005 Posts: 869
|
Posted: Sun Mar 09, 2008 11:09 pm Post subject: |
|
|
Quote: | KEYWORDS="-* amd64 x86" |
Wow, that was quick, and I always thought that the arch teams would only stabilise _normal_ packages after 30 days _________________ ______________
Help the gentoo-java project. Visit Gentoo Java Project
what good are admin powers if you don't abuse them for personal gain - mark_alec |
|
Back to top |
|
|
foreboy n00b
Joined: 08 Mar 2008 Posts: 0
|
Posted: Mon Mar 10, 2008 2:19 am Post subject: |
|
|
ok ok that was an oops - i did say I hacked up the realplayer ebuild its not like it's in portage |
|
Back to top |
|
|
desultory Bodhisattva
Joined: 04 Nov 2005 Posts: 9410
|
|
Back to top |
|
|
mointrigue n00b
Joined: 07 Mar 2006 Posts: 57 Location: Madison, WI USA
|
Posted: Tue Mar 11, 2008 8:07 pm Post subject: |
|
|
Hmm, doesn't work for me on amd64. Probably because gtkmm doesn't seem to be in the emul-linux-x86-* packages. It installs because I do have 64 bit gtkmm, but won't run.
Quote: | amazonmp3: error while loading shared libraries: libgtkmm-2.4.so.1: cannot open shared object file: No such file or directory |
|
|
Back to top |
|
|
SDNick484 Apprentice
Joined: 05 Dec 2005 Posts: 231
|
Posted: Sat Mar 15, 2008 7:19 pm Post subject: |
|
|
It's not starting in x86 for me throwing the error:
amazonmp3: error while loading shared libraries: libatkmm-1.6.so.1: cannot open shared object file: No such file or directory
When I look for libatkmm, all I see is:
/usr/lib/libatkmm-1.0.so
/usr/lib/libatkmm-1.0.so.1.5.11
/usr/lib/libatkmm-1.0.so.1
The library seems to belong to dev-cpp/gtkmm. I do have the accessibility flag disabled for this package, and I believe atk is usually related to that, so perhaps that's why I'm missing the libraries. Will try rebuilding gtkmm and posting the results later.
UPDATE: Yeah, rebuilding dev-cpp/gtkmm with the accessibility USE flag resolved my error. I haven't tried to download anything yet, but the program actually runs now. |
|
Back to top |
|
|
spindle Apprentice
Joined: 01 Dec 2003 Posts: 245
|
Posted: Fri Apr 11, 2008 4:14 am Post subject: |
|
|
foreboy wrote: | pkg_setup should probably be, for completeness,
Code: | pkg_setup() {
if ! built_with_use dev-cpp/gtkmm accessibility api-atkmm; then
eerror "You need to build dev-cpp/gtkmm with USE=accessibility api-atkmm enabled."
die "gtkmm without necessary use flags detected"
fi
# This is a binary x86 package => ABI=x86
has_multilib_profile && ABI="x86"
}
|
BTW this was modeled on the realplayer ebuild, which is where I first saw rpm_src_unpack |
I'm confused by this. I don't see api-atkmm as a use flag for this package or anywhere else. Am I missing something?
Thanks for this ebuild. I started building a "quick" ebuild for this based on the realplayer package as well and it turned out to be a bit more work than I thought it would be. |
|
Back to top |
|
|
ppurka Advocate
Joined: 26 Dec 2004 Posts: 3256
|
Posted: Fri Apr 11, 2008 4:34 am Post subject: |
|
|
spindle wrote: | I'm confused by this. I don't see api-atkmm as a use flag for this package or anywhere else. Am I missing something?
Thanks for this ebuild. I started building a "quick" ebuild for this based on the realplayer package as well and it turned out to be a bit more work than I thought it would be. | It worked for me even after I removed that USE flag. I had also changed the cp's to insinto and doins. _________________ emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/ |
|
Back to top |
|
|
spindle Apprentice
Joined: 01 Dec 2003 Posts: 245
|
Posted: Fri Apr 11, 2008 3:39 pm Post subject: |
|
|
ppurka wrote: | It worked for me even after I removed that USE flag. I had also changed the cp's to insinto and doins. |
I had to do the same thing with the use flags to get it to install.
Could you post your version? That seems more correct to me than the cp's and mkdirs, etc. so portage can track those files. |
|
Back to top |
|
|
ppurka Advocate
Joined: 26 Dec 2004 Posts: 3256
|
Posted: Fri Apr 11, 2008 9:23 pm Post subject: |
|
|
spindle wrote: | ppurka wrote: | It worked for me even after I removed that USE flag. I had also changed the cp's to insinto and doins. |
I had to do the same thing with the use flags to get it to install.
Could you post your version? That seems more correct to me than the cp's and mkdirs, etc. so portage can track those files. | Portage will track those files anyway. But here it is. Of course, main credit should go to foreboy
Code: | # Distributed under the terms of the GNU General Public License v2
# be kind, give credit: initial, Paul Cifarelli <paul@cifarelli.net>
inherit eutils rpm
MY_PN="amazonmp3"
DESCRIPTION="Amazon mp3 downloader"
HOMEPAGE="http://www.amazon.com/gp/dmusic/help/amd.html?ie=UTF8&forceos=LINUX&ASIN=&isTrack="
SRC_URI="${MY_PN}-${PV}-1.fedora8.i386.rpm"
LICENSE="EUBL"
SLOT="0"
KEYWORDS="-* amd64 x86"
IUSE="X"
RESTRICT="strip test fetch"
RDEPEND="dev-cpp/glibmm dev-cpp/cairomm dev-cpp/gtkmm >=dev-libs/boost-1.34"
pkg_nofetch() {
einfo "Download the Amazon Downloader manually from Amazon's website at"
einfo ${HOMEPAGE}
einfo ""
einfo "Click \"I agree to the terms of use\" &"
einfo "Choose the Download now Fedora 8 button"
einfo ""
einfo "Then place the file ${SRC_URI}"
einfo "into ${DISTDIR} and restart the emerge."
}
pkg_setup() {
if ! built_with_use dev-cpp/gtkmm accessibility; then
eerror "You need to build dev-cpp/gtkmm with USE=accessibility enabled."
die "gtkmm without necessary use flags detected"
fi
# This is a binary x86 package => ABI=x86
has_multilib_profile && ABI="x86"
}
src_unpack() {
rpm_src_unpack
}
src_install() {
exeinto /usr/bin
doexe ${WORKDIR}/usr/bin/amazonmp3
insinto /usr/share/applications
domenu ${WORKDIR}/usr/share/applications/amazonmp3.desktop
insinto /usr/share/doc/amazonmp3
doins ${WORKDIR}/usr/share/doc/amazonmp3/*
insinto /usr/share/mime-info
doins ${WORKDIR}/usr/share/mime-info/*
insinto /usr/share/mime/packages
doins ${WORKDIR}/usr/share/mime/packages/amazonmp3.xml
insinto /usr/share/mimelnk/audio
doins ${WORKDIR}/usr/share/mimelnk/audio/x-amzxml.desktop
insinto /usr/share/pixmaps
doins ${WORKDIR}/usr/share/pixmaps/amazonmp3.png
# insinto /usr/share/applications
# domenu ${WORKDIR}/usr/share/applications/amazonmp3.desktop
cd ${D}/usr/lib
dosym libssl.so /usr/lib/libssl.so.6
dosym libcrypto.so /usr/lib/libcrypto.so.6
dosym libboost_date_time.so /usr/lib/libboost_date_time.so.3
dosym libboost_signals.so /usr/lib/libboost_signals.so.3
dosym libboost_iostreams.so /usr/lib/libboost_iostreams.so.3
dosym libboost_thread-mt.so /usr/lib/libboost_thread-mt.so.3
} |
EDIT: I just realized that I was putting amazonmp3.desktop twice in /usr/share/applications directory. Fixed it now. _________________ emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/ |
|
Back to top |
|
|
spindle Apprentice
Joined: 01 Dec 2003 Posts: 245
|
Posted: Fri Apr 11, 2008 9:49 pm Post subject: |
|
|
ppurka wrote: | Portage will track those files anyway. |
Cool. that's good to know.
Thanks for posting your changes to the script, looks good (although I know very little about portage programming). Maybe someone should put this into cvs proper... |
|
Back to top |
|
|
desultory Bodhisattva
Joined: 04 Nov 2005 Posts: 9410
|
Posted: Fri Apr 11, 2008 10:55 pm Post subject: |
|
|
While actually being added to the tree is dependent upon developer interest, submitting it for inclusion is not. |
|
Back to top |
|
|
blackbrass88 n00b
Joined: 28 Apr 2008 Posts: 1
|
Posted: Mon Apr 28, 2008 5:52 pm Post subject: |
|
|
thanks foreboy and ppurka for the ebuilds, worked great! |
|
Back to top |
|
|
SDNick484 Apprentice
Joined: 05 Dec 2005 Posts: 231
|
Posted: Wed Jun 18, 2008 4:36 am Post subject: |
|
|
The latest version of boost, 1.35.0-r1, breaks amazonmp3:
~ $ amazonmp3
amazonmp3: symbol lookup error: amazonmp3: undefined symbol: _ZN5boost5mutexC1Ev
~ $
I could get it working again by downgrading to 1.34.1-r2 (it required switching to gcc-4.2.4 as gcc-4.3.1 wouldn't build the older version of boost). I tried the Suse version of amazonmp3 (the ebuild uses the Fedora one), but it also failed with the same error after creating the symlinks it needed; it also needs the old version of boost. At this point we probably need to wait for amazon to provide a new version. |
|
Back to top |
|
|
slackbassist n00b
Joined: 22 Jun 2006 Posts: 39
|
Posted: Sun Jan 11, 2009 11:16 pm Post subject: Open Source Alternative |
|
|
There's an OSS alternative that works really well, Clamz
http://code.google.com/p/clamz/
it's a pretty simple CLI tool, but it gets the job done. More importantly, it doesn't rely on boost.
If you're really lazy (like me), I've written a hack-job wrapper script that allows you to download the files to wherever you tell it to, or to /home/$USER/music otherwise:
Code: |
#!/bin/bash
#download amz files to the desired directory
CURRDIR=$PWD
if [ -z "$1" ]; then
echo "Usage: /clamz-script [.amz file] [Target Directory]"
exit 1
else
AMZFILE=$1
fi
if [ -z "$2" ]; then
MUSICLOC="/home/$USER/music"
else
MUSICLOC="$2"
fi
echo "Downloading $AMZFILE to $MUSICLOC."
cd $MUSICLOC
clamz "$CURRDIR/$AMZFILE"
if [ $? != 0 ]; then
echo "Fetch Failed"
exit 5
fi
echo "Fetch Successful. Cleaning Up."
rm "$CURRDIR/$AMZFILE"
cd $CURRDIR
exit 0
|
The script assumes that you're not entering a full pathname for the .amz file. Any way to test for this? |
|
Back to top |
|
|
fcgreg Apprentice
Joined: 17 May 2003 Posts: 264 Location: California, USA
|
Posted: Mon Mar 09, 2009 9:10 am Post subject: Re: Open Source Alternative |
|
|
slackbassist wrote: | There's an OSS alternative that works really well, Clamz
http://code.google.com/p/clamz/
it's a pretty simple CLI tool, but it gets the job done. More importantly, it doesn't rely on boost. |
Thanks for turning us on to this little gem. I used clamz and it worked great. It is quite full of features, too. It doesn't pull down cover art, of course, but you can grab it yourself by viewing the output of the .amz file (in xml output or whatever). Enjoy! _________________ Greg T. |
|
Back to top |
|
|
BitJam Advocate
Joined: 12 Aug 2003 Posts: 2508 Location: Silver City, NM
|
Posted: Tue Mar 24, 2009 6:32 pm Post subject: |
|
|
Another clamz fan here. The GUI downloaders were a huge PITA. Clamz is near perfect IMO, especially for Gentooers. |
|
Back to top |
|
|
Grahammm Tux's lil' helper
Joined: 01 Sep 2004 Posts: 84 Location: Berkshire UK
|
Posted: Sat Mar 28, 2009 12:07 pm Post subject: |
|
|
Do any of these mechanisms work for downloads from amazon.co.uk? Both the amazon downloading in portage and clamz seem to be only designed for the US amazon.com site not the UK amazon.co.uk which also has mp3 downloads. |
|
Back to top |
|
|
fcgreg Apprentice
Joined: 17 May 2003 Posts: 264 Location: California, USA
|
Posted: Sun Mar 29, 2009 12:42 am Post subject: clamz should work either way |
|
|
Grahammm wrote: | Do any of these mechanisms work for downloads from amazon.co.uk? Both the amazon downloading in portage and clamz seem to be only designed for the US amazon.com site not the UK amazon.co.uk which also has mp3 downloads. |
While I haven't tested clamz with the UK Amazon site, it should work either way. This is because the URL of the download site(s) are contained within the .amz file itself. clamz shouldn't care where it is downloading from, theoretically.
However, if the UK Amazon site is using a different API (interface) for its downloads I suppose there may be a problem. Have you actually tried clamz with an .amz file downloaded from the UK site? I suspect it will work just fine. _________________ Greg T. |
|
Back to top |
|
|
noodge n00b
Joined: 20 Jun 2005 Posts: 5
|
Posted: Thu Apr 02, 2009 8:50 am Post subject: Another wrapper script |
|
|
Not sure how helpful this is, but it's a different wrapper script for clamz that also fetches the album art. Hopefully someone finds this useful. Change "/home/dustin/music" to something that actually applies to you.
Code: |
#!/usr/bin/perl -w
use strict;
my $workdir = `pwd`;
chomp $workdir;
(-e $ARGV[0]) || die "File does not exist";
my @bleh = `clamz -i '$ARGV[0]'`;
my %song_info;
my @songs;
foreach (@bleh) {
if (/^\*\s+(Title|Creator|Image):\s+(.*)/){
$song_info{$1} = ($1 eq 'Image') ? $2 : clean_filename($2);
}
}
my $artist_dir = "/home/dustin/music/albums/$song_info{Creator}";
my $song_dir = "$artist_dir/$song_info{Title}";
unless (-e $artist_dir) {
mkdir ($artist_dir) || die "Couldn't make artist dir";
}
mkdir ($song_dir) || die "Couldn't make song dir";
chdir ($song_dir) || die "Couldn't go to song dir";
#get album art
system ("wget $song_info{Image}");
my $tmp = reverse($song_info{Image});
$tmp =~ s/^([^\/]+).*/$1/;
system ("mv " . reverse ($tmp) . " cover.jpg");
#actually get songs
system ("clamz '$workdir/$ARGV[0]'");
sub clean_filename {
my $filename = shift;
$filename =~ tr{*\"><[]|:;,'=/?}{_};
return $filename;
}
|
|
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Sat Apr 11, 2009 6:12 pm Post subject: |
|
|
I hadn't heard of clamz until reading this...great stuff!...especially compared to all the awful dependencies of amazonmp3.
The fact that the -d (--output-dir) doesn't work with fully qualified paths had me going nuts though.
Tom |
|
Back to top |
|
|
stychokiller n00b
Joined: 27 Apr 2005 Posts: 53 Location: Slayon MN. USA
|
Posted: Tue Nov 10, 2009 6:57 am Post subject: Re: Another wrapper script |
|
|
noodge wrote: | Not sure how helpful this is, but it's a different wrapper script for clamz that also fetches the album art. Hopefully someone finds this useful. Change "/home/dustin/music" to something that actually applies to you.
Code: |
#!/usr/bin/perl -w
use strict;
my $workdir = `pwd`;
chomp $workdir;
(-e $ARGV[0]) || die "File does not exist";
my @bleh = `clamz -i '$ARGV[0]'`;
my %song_info;
my @songs;
foreach (@bleh) {
if (/^\*\s+(Title|Creator|Image):\s+(.*)/){
$song_info{$1} = ($1 eq 'Image') ? $2 : clean_filename($2);
}
}
my $artist_dir = "/home/dustin/music/albums/$song_info{Creator}";
my $song_dir = "$artist_dir/$song_info{Title}";
unless (-e $artist_dir) {
mkdir ($artist_dir) || die "Couldn't make artist dir";
}
mkdir ($song_dir) || die "Couldn't make song dir";
chdir ($song_dir) || die "Couldn't go to song dir";
#get album art
system ("wget $song_info{Image}");
my $tmp = reverse($song_info{Image});
$tmp =~ s/^([^\/]+).*/$1/;
system ("mv " . reverse ($tmp) . " cover.jpg");
#actually get songs
system ("clamz '$workdir/$ARGV[0]'");
sub clean_filename {
my $filename = shift;
$filename =~ tr{*\"><[]|:;,'=/?}{_};
return $filename;
}
|
|
Your perl script bombs out with the following errors on my PC:
"Use of uninitialized value in concatenation (.) or string at perl_script line 17"
"Use of uninitialized value in concatenation (.) or string at perl_script line 18"
"Couldn't make song dir at perl_script line 24"
I don't know enough about perl to debug your code. _________________ Time flies like an arrow. Fruit flies like a banana. |
|
Back to top |
|
|
noodge n00b
Joined: 20 Jun 2005 Posts: 5
|
Posted: Tue Nov 10, 2009 8:57 am Post subject: |
|
|
Oh yeah, that's my mistake. I made some fixes a while back and never posted them
Code: | #!/usr/bin/perl -w
use strict;
my $workdir = `pwd`;
chomp $workdir;
(-e $ARGV[0]) || die "File does not exist";
my @bleh = `clamz -i '$ARGV[0]'`;
my %song_info;
my @songs;
foreach (@bleh) {
if (/(Album Artist|Album|Creator|Image):\s+(.*)/){
unless (exists $song_info{$1}) {
$song_info{$1} = ($1 eq 'Image') ? $2 : clean_filename($2);
}
}
}
my $artist_dir = (exists $song_info{'Album Artist'}) ? "/home/dustin/music/albums/$song_info{'Album Artist'}" : "/home/dustin/music/albums/$song_info{Creator}";
my $song_dir = "$artist_dir/$song_info{Album}";
unless (-e $artist_dir) {
mkdir ($artist_dir) || die "Couldn't make artist dir";
}
unless (-e $song_dir) {
mkdir ($song_dir) || die "Couldn't make song dir";
}
print "Installing songs at $song_dir\n";
chdir ($song_dir) || die "Couldn't go to song dir";
#get album art
system ("wget $song_info{Image}");
my $tmp = reverse($song_info{Image});
$tmp =~ s/^([^\/]+).*/$1/;
system ("mv " . reverse ($tmp) . " cover.jpg");
#actually get songs
system ("clamz '$workdir/$ARGV[0]'");
sub clean_filename {
my $filename = shift;
$filename =~ tr{*\"><[]|:;,'=/?}{_};
return $filename;
}
|
|
|
Back to top |
|
|
|