Re: [Bug-gnupod] release 0.99.8 nearing completion
H. Langos wrote: > Sorry, but I delayed that to the next release. Moving the documentation > into the perl files required some changes to the build/install mechanics > of gnupod. Those changes triggered some even deeper changes to the > build process that are not yet complete. Making the documents the primary documentation would. I can see that. However merely adding it in to the .pm files themselves shouldn't require any build process changes. Still, I agree that getting the bug fixes out as soon as possible is a noble goal, and the new documentation should probably be careful reviewed before being stamped as official. > Your changes are however in the master branch and will be in the > next release after 0.99.8. Do you have an anticipated release date? J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia| (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001| _..`--'_..-_/ /--'_.' ,' | cont...@perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | ___ Bug-gnupod mailing list Bug-gnupod@nongnu.org http://lists.nongnu.org/mailman/listinfo/bug-gnupod
Re: [Bug-gnupod] release 0.99.8 nearing completion
H. Langos wrote: > This release is mostly a bugfix release. Ubuntu users in > particular should no longer see mktunes hanging on auto > detection of the fwguid and 4gen nano users will enjoy > complete artwork support. Will the documentation I provided or something like it be added? I couldn't spot it in a cursory glance over the coloured diff. J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia| (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001| _..`--'_..-_/ /--'_.' ,' | cont...@perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | ___ Bug-gnupod mailing list Bug-gnupod@nongnu.org http://lists.nongnu.org/mailman/listinfo/bug-gnupod
Re: [Bug-gnupod] mktunes.pl creates corrupt iTunesDB ?
H. Langos wrote: > Speaking of readability and code style. Is there a consensus among the > experienced and community-minded folks in regard to the passing of > parameters to subs? Especially when writing subs in modules? > > I nowadays prefer to pass parameters as one hashref > subname({foo => "x", bar => "y"}); > instead of as a naked list: > subname("x", "y"); > or (heaven help) > subname(foo => "x", bar => "y"); > which looks like a hash but is only a list. > > I took a look at perlstyle(1) and perlsub(1) but I didn't see any hints in > regard to this. This practice is called named arguments and is a great way of calling subroutines because it removes the confusion of which order the arguments need to go in. It also allows you to set and use defaults, for example: subname({foo => "x", bar => "y"}); subname({foo => "x"}); subname({bar => "y"}); subname(); ... my %defaults = ( foo => 'a', bar => 'b', }; sub subname { my ($args_ref) = @_; state %defaults = ( # 5.10+ only, else "my %defaults" foo => 'a', # or a closure bar => 'b', ); $args_ref = { %defaults, %{$args_ref} }; # Now you know for sure that "foo" and "bar" have values # for all the above calls. } It's not discussed in perlstyle, and perlsub because the maintainers of those files haven't really decided on a one-true way, or because they've been too lazy to write it... Damian Conway wrote bunch of good ideas about good Perl style in his book called Perl Best Practices, which is what most people point to when they talk about Perl style now. These practices have been turned into requirements by the Perl::Critic system too, so you can get automated feedback on your code quality by using the Perl::Critic programs. Anyway, Damian advises: Use a hash of named arguments for any subroutine that has more than 3 parameters and agrees entirely with your preference: subname({foo => "x", bar => "y"}); rather than the alternatives you give. This has the advantage that mistakes in how you call the subroutine may be spotted at compile time rather than run time: subname({foo => "x", bar => "y", cols => 1..4}); Odd number of elements in anonymous hash at demo.pl line 2 He also says it's okay to mix positional and named arguments if you don't have many but some are always mandatory. For example: padded($string, {cols => 20, centered =>1, filler=>$SPACE}); sub padded { my ($text, $args_ref) = @_; # pad the string. } Hope this helps. J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia| (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001| _..`--'_..-_/ /--'_.' ,' | cont...@perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | ___ Bug-gnupod mailing list Bug-gnupod@nongnu.org http://lists.nongnu.org/mailman/listinfo/bug-gnupod
Re: [Bug-gnupod] mktunes.pl creates corrupt iTunesDB ?
H. Langos wrote: One more question: Why did you use &resetxml; instead of resetxml(); ? I know the former doesn't pass an empty @_ array for the called sub but passes the existing argument list. But you don't do anything with @_ in resetxml(). So why bother passing the current arguments list on to it? I imagine that the author didn't intend that effect of calling the subroutine that way. I suspect it's a matter of laziness. FWIW, resetxml(); or resetxml(@_); # if necessary are both many, many times preferable to: &resetxml; and the latter is generally shunned by experienced, community-minded Perl folk. I'd suggest applying the patch with this tidied up as appropriate. J ___ Bug-gnupod mailing list Bug-gnupod@nongnu.org http://lists.nongnu.org/mailman/listinfo/bug-gnupod
[Bug-gnupod] Documentation
G'day folk, Although the documentation in the current CVS version is much improved vs the release late last year, it strikes me that so much more could be written. I'm not a huge fan of the info way of navigating data and I've never learned how to write info files, so I've been writing in POD. My thought is that the POD could be included in the relevant files (where possible) as well as creating other .pod files as required to provide all the necessary documentation. I've certainly typed "perldoc gnupod_addsong.pl" enough times without thinking about it. As such I've written documentation for gnupod_search.pl and gnupod_addsong.pl as well as some documentation for GNUtunesDB.xml. This still needs all the installation advice, using firewire and Macs advice, and other similar parts. However, I doubt I'll have a chance to do those soon, so I thought I'd make this part available. It would be awesome if we could improve the documentation to show how to add videos and TV Shows, but I'm not 100% sure that gnupod_addsong could handle that yet. Feel free to mercilessly edit what I've written and coerce it into an info format if you'd prefer. J =head1 Name gnupod_addsong.pl - Adds files to the iPod =head1 SYNOPSIS # Mount the iPod mount /mnt/ipod # Sync changes made by other tools (such as iTunes) # only necessary if you are using other tools in addition to these tunes2pod.pl -m /mnt/ipod # Add a song gnupod_addsong.pl -m /mnt/ipod /tmp/foo.mp3 # You can also use wild cards and add more than one song at a time gnupod_addsong.pl -m /mnt/ipod /mnt/mp3/seiken_densetsu2_ost/* /mnt/mp3/xenogears/ost?/* # Convert to mp3 on the fly gnupod_addsong.pl -m /mnt/ipod myfile.flac myfile.ogg --decode=mp3 # Add songs with artwork gnupod_addsong.pl -m /mnt/ipod /mnt/mp3/amos/* --artwork=amos.jpg # Add songs into playlists gnupod_addsong.pl -m /mnt/ipod --playlist=Party --playlist=Driving /tmp/*.mp3 # Add a podcast (not the same as a regular song) gnupod_addsong.pl -m /mnt/ipod -p "Podcast Title" --playlist-is-podcast podcast.mp3 # Add more than one podcast gnupod_addsong.pl -m /mnt/ipod -p "Podcast Title" --playlist-is-podcast podcasts/* # Fetch podcasts online and add to iPod gnupod_addsong.pl -m /mnt/ipod -p "Heute Morgen" --playlist-is-podcast http://pod.drs.ch/heutemorgen_mpx.xml # Record the changes to the iTunes database (this is essential) mktunes.pl -m /mnt/ipod # Unmount and go umount /mnt/ipod =head1 DESCRIPTION C copies songs onto the iPod and updates the GNUtunesDB.xml database. For these changes to be visible to the iPod, C must be run. =head1 OPTIONS =head2 Generic Program Information =over 4 =item -h, --help Lists out all the options. =item --version Output version information and exit. =item -m, --mount=directory iPod mount point, default is C<$IPOD_MOUNTPOINT>. =back =head2 Disaster recovery =over 4 =item -r, --restore Restore the iPod (create a new GNUtunesDB from scratch). This will rediscover all the songs on the iPod, but will lose playlists and data not stored in the mp3 header information. =back =head2 Duplicate management =over 4 =item -d, --duplicate It isn't possible to add the same MP3 multiple times, gnupod_addsong.pl detects duplicates (Duplicate = same filesize/time and ID3Tag name). You can disable the duplicate-detection with the '--duplicate' switch. =back =head2 Playlists =over 4 =item -p, --playlist=string Add songs to this playlist, can be used multiple times. Playlists can also be added manually, as covered later. =back =head2 Podcasts See also the later section on podcasts. =over 4 =item --playlist-is-podcast Set podcast flag for playlist(s) created using '--playlist'. =item --podcast-artwork Download and install artwork for podcasts from their channel. =item --podcast-cache-dir=string Set a directory in which podcast media files will be cached. =item --podcast-files-limit=int Limit the number of files that are downloaded. 0 = download all (default), -X = download X oldest items, X = download X newest items =back =head2 Decoding MP3/WAV (RIFF) and M4A (Apple AAC) files can be added directly. FLAC and OGG files can be decoded and also added. C attempts to 'auto-detect' the encoding. (Note: To use all features of --decode, you will have to install Audio::FLAC::Header, Ogg::Vorbis::Header::PurePerl, lame, flac, oggenc and faac) =over 4 =item -x, --decode=pcm|mp3|aac|aacbm Convert FLAC Files to WAVE/MP3 or AAC 'on-the-fly'. Use '-e' to specify a quality/bitrate. =item -x, --decode=video Convert .avi Files into iPod video 'on-the-fly' (needs ffmpeg with AAC support). =item -x, --decode=alac Convert FLAC Files into Apple Lossless 'on-the-fly' (needs ffmpeg with ALAC support). =item -e, --reen
Re: [Bug-gnupod] Re: problem with gnupod
H. Langos wrote: Hi Adam, As you already figured out, the trouble was caused by gnupod trying to find the devices serial number (aka fwid). The problem is that gnupod used a rather crude way to look for the device in /sys/block and ubuntu has recently made some big changes there. The problem you describe has been reported before: http://lists.gnu.org/archive/html/bug-gnupod/2009-04/msg3.html It would be great if you could check out the current CVS version of gnupod to see if it works any better: sudo su - apt-get remove gnupod-tools apt-get -y install cvs apt-get -y install autoconf cvs -z3 -d:pserver:anonym...@cvs.savannah.gnu.org:/sources/gnupod co gnupod cd gnupod autoconf ./configure make intall I can confirm that this version does fix the mktunes.pl problem. J ___ Bug-gnupod mailing list Bug-gnupod@nongnu.org http://lists.nongnu.org/mailman/listinfo/bug-gnupod
[Bug-gnupod] Documentation on dealing with podcasts
First of all, thank-you so very much for this tool, it is absolutely awesome that I can manage my iPod via scripts and on the command-line. As a Perl programmer, I find it much easier to knock up a script to rename titles than to work out how to automate that through a GUI! The documentation for 4.8 Dealing with podcasts is very slim. I was trying to add podcasts for the first time today, and found that when I added podcast files using gnupod_addsong: gnupod_addsong -m /mnt/usb podcasts/* that my 4th Gen Nano iPod would refuse to see them as Podcast files even after I had created a playlist as recommended in the documentation. This turned out to be because the media value (and possibly some other flags) was set incorrectly. It took me several hours of mounting and unmounting to finally spot what was going on. I think it would be helpful if the documentation was expanded, as below: ## 4.8 Dealing with podcasts Do not add podcast files in the same way as you add regular songs. In order for your iPod to distinguish between Podcasts and songs, we need to make sure the media type is set correctly. To add a single podcast do the following: gnupod_addsong.pl -p "Podcast Title" --playlist-is-podcast podcast.mp3 You can add multiple podcasts to the same title as well: gnupod_addsong.pl -p "Podcast Title" --playlist-is-podcast podcasts/* This also tells the iPod to skip this file when shuffling files. See gnupod_addsong.pl -h for more options. If you want to create additional podcast playlists you just need to set the podcast flag to '1': Such a playlist will show up as a Podcast after running mktunes.pl gnupod_addsong.pl can also download podcasts and create such playlists itself: gnupod_addsong.pl -p "Heute Morgen" --playlist-is-podcast http://pod.drs.ch/heutemorgen_mpx.xml Running this command will create a Playlist called 'Heute Morgen' (-p) and set podcast="1" (--playlist-is-podcast). gnupod_addsong.pl will then fetch the podcast from http://pod.drs.ch/heutemorgen_mpx.xml, download all (new) files and add them to the 'Heute Morgen' playlist! ## All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia| (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001| _..`--'_..-_/ /--'_.' ,' | cont...@perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | ___ Bug-gnupod mailing list Bug-gnupod@nongnu.org http://lists.nongnu.org/mailman/listinfo/bug-gnupod