[bglug] Coverdl 0.2

Joe Galaxy joegalaxy@gmail.com
Gio 1 Dic 2011 12:17:17 CET


Come prima, ma anzichè scrivere artista e titolo basta dargli in pasto
il nome del file. Poichè gli id2/id3 sono solo per gli mp3, se avete
un m4a o altro è grave; qui ad esempio coverlovin.py fallisce.
Allora prendiamo i tags con mplayer ;)

----8<---- CUT HERE ----8<----
#!/bin/bash
# Time-stamp: <coverdl-0.2, 1/12/2011 12:9:43 joe Exp>
# Copyright (c) 2011, Joe Galaxy <joegalaxy[at]gmail[dot]com>
# All rights reserved.

# REDISTRIBUTION and  use in  source and binary  forms, with  or without
# modification, are permitted provided that the following conditions are
# met:

#     * Redistributions of  source code must retain  the above copyright
#       notice, this list of conditions and the following disclaimer.
    
#     * Redistributions  in   binary  form  must   reproduce  the  above
#       copyright  notice, this  list  of conditions  and the  following
#       disclaimer in the  documentation and/or other materials provided
#       with the distribution.
    
#     * Neither the name of Joe Galaxy nor the names of its contributors
#       may be  used to  endorse or promote  products derived  from this
#       software without specific prior written permission.

# THIS SOFTWARE  IS PROVIDED BY  THE COPYRIGHT HOLDERS  AND CONTRIBUTORS
# "AS  IS" AND  ANY EXPRESS  OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT
# LIMITED TO, THE IMPLIED  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE  ARE DISCLAIMED. IN NO EVENT  SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL  DAMAGES (INCLUDING,  BUT  NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE  GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS  INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF  LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY,  OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING  IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


# Usage: coverdl <file>

## quante ne vuoi?
hmany="8"
## small, medium, large
size="medium"


artist=`mplayer -ao null -identify -frames 0 $1 | awk -F"artist: " '{print $2}'`
album=`mplayer -ao null -identify -frames 0 $1 | awk -F"album: " '{print $2}'`
query=`echo "$artist $album" | sed -e 's/+/%2b/g;s/"/%22/g;y/ /+/'`
outdir=`echo $query | sed 's/+/_/g'`

get=`links -dump "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=$query&as_filetype=jpg&imgsz=$size&rsz=$hmany" | awk -F"\"unescapedUrl\":" '{print $2}' | awk -F"," '{print $1}' | sed -e '/^$/d' -e 's/\"//g'`

mkdir -p "$outdir"
cd "$outdir"
wget $get
----8<---- CUT HERE ----8<----


-- 
$(echo 502625742692402704447754P|dc)@gmail.com


Maggiori informazioni sulla lista bglug