diff options
author | yvesf <yvesf-git@xapek.org> | 2011-07-16 11:49:01 +0200 |
---|---|---|
committer | yvesf <yvesf-git@xapek.org> | 2011-07-16 11:49:01 +0200 |
commit | 6ba7fa0dba08d1b91cf42a8a797b7f5ad44ec217 (patch) | |
tree | 806679f70f30b2a2e4fd3ffd8a1215af05f8b9f1 /m_dl.sh | |
parent | fade859723fa5b4607fd060c0b1778854d680144 (diff) | |
download | scripts-6ba7fa0dba08d1b91cf42a8a797b7f5ad44ec217.tar.gz scripts-6ba7fa0dba08d1b91cf42a8a797b7f5ad44ec217.zip |
reorganize files; add micromusic download
Diffstat (limited to 'm_dl.sh')
-rwxr-xr-x | m_dl.sh | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/m_dl.sh b/m_dl.sh deleted file mode 100755 index 283d273..0000000 --- a/m_dl.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -XSLT_TRACKLIST="`dirname \"$0\"`/tracklist.xsl" -check() { - if ! type ${1} >/dev/null 2>&1; then - echo "missing ${1}${2}" - exit 2 - fi -} - -check rtmpdump -check xsltproc -check ffmpeg -check vorbiscomment ": see vorbis-tools package" - -getplid() { - wget -q -O - "$1" | sed -n -e 'b start; :quit; q; :start; s/.*plid=\([0-9]*\).*/\1/p; t quit' -} - -getfriendid() { - wget -q -O - "$1" | sed -n -e 'b start; :quit; q; :start; s/.*friendId=\([0-9]*\).*/\1/p; t quit' -} - - -eachSong() { - for song in `wget -O - -q "http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?action=getPlaylist&friendId=${2}&playlistId=${1}" | xsltproc "${XSLT_TRACKLIST}" -`; do - songId=`echo $song | cut -d \; -f 1` - albumId=`echo $song | cut -d \; -f 2` - releaseId=`echo $song | cut -d \; -f 3` - title=`echo $song | cut -d \; -f 4` - artist=`echo $song | cut -d \; -f 5` - if [ "xx${songId}" == "xx" ] || [ "xx${albumId}" == "xx" ] || [ "xx${releaseId}" == "xx" ] || [ "xx${title}" == "xx" ]; then - echo "skip: ${song}" >&2 - continue - fi - echo "load: ${song}" >&2 - if [ "xx${albumId}" == "xx0" ]; then - rtmpUrl=`wget -O - -q \ - "http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?releaseId=${releaseId}&sample=0&el=&action=getSong&songId=${songId}&ptype=4" \ - | sed -n -e 's/.*<rtmp>rtmp\(.*\)<\/rtmp>.*/rtmpe\1/p'` - - else - rtmpUrl=`wget -O - -q \ - "http://musicservices.myspace.com/Modules/MusicServices/Services/MusicPlayerService.ashx?albumId=${albumId}&sample=0&el=&action=getSong&songId=${songId}&ptype=4" \ - | sed -n -e 's/.*<rtmp>rtmp\(.*\)<\/rtmp>.*/rtmpe\1/p'` - fi - if [ "xx${rtmpUrl}" == "xx" ]; then - echo "could not find rtmpe URL" >&2 - else - filename=${title}.ogg - download "${rtmpUrl}" "${filename}" - vorbiscomment -w -t "ARTIST=${artist}" -t "TITLE=${title}" "${filename}" - fi - done - echo done -} - -download() { - echo ${1} ${2} - if [ -f "${2}" ]; then - echo "Skip ${2} - file exist" - return - else - echo "load ${2}" - rtmpdump -o - -r "$1" \ - | ffmpeg -f flv -i - -acodec libvorbis -ab 192k -ar 44100 -vn "${2}" - fi -} - -if [ $# -eq 1 ]; then - plid=`getplid "$1"` - friendId=`getfriendid "$1"` - if [ "xx${plid}" == "xx" ] || [ "xx${friendId}" == "xx" ]; then - echo "no plid/friendid found for $1" >&2 - else - echo "load all songs from playlist id=$plid friendId=$friendId" >&2 - eachSong "$plid" "$friendId" - fi -else - echo "$0 URL - loads all music files from a myspace profile" - echo "URL in form: http://www.myspace.com/PROFILE" -fi |