First import.
This commit is contained in:
commit
c6832dfebe
4 changed files with 184 additions and 0 deletions
39
index.shtml
Normal file
39
index.shtml
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="900">
|
||||
<title>Erik's Playlist</title>
|
||||
<style type="text/css">
|
||||
body, th, td {font-family:verdana, sans-serif; font-size:70%; line-height:150%}
|
||||
small {color:gray; font-size:85%; line-height:110%}
|
||||
strong {font-size:160%}
|
||||
A {color:black; text-decoration:none}
|
||||
A:visited {color:black; text-decoration:none}
|
||||
A:hover {color:black; text-decoration:underline}
|
||||
A:active {color:black; text-decoration:underline}
|
||||
A.small {color:gray}
|
||||
A.small:visited {color:gray}
|
||||
A.small:hover {color:gray}
|
||||
A.small:active {color:gray}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<strong>Erik's Playlist</strong>
|
||||
<hr size="1px" noshade>
|
||||
<blockquote>
|
||||
<table width="80%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th align="left" width="35%">Song Title</th>
|
||||
<th align="left" width="10"> </th>
|
||||
<th align="left" width="30%">Artist</th>
|
||||
<th align="left" width="10"> </th>
|
||||
<th align="left">Album</th>
|
||||
</tr>
|
||||
<tr><td colspan="5" height="1"><hr size="1px" noshade></td></tr>
|
||||
|
||||
<!--#include file="playlist.txt" -->
|
||||
</table>
|
||||
</blockquote>
|
||||
<hr size="1px" noshade>
|
||||
</body>
|
||||
</html>
|
1
xmmslist.cron
Normal file
1
xmmslist.cron
Normal file
|
@ -0,0 +1 @@
|
|||
*/15 * * * * ${HOME}/bin/xmmslist.sh
|
114
xmmslist.py
Executable file
114
xmmslist.py
Executable file
|
@ -0,0 +1,114 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
#
|
||||
# File: xmmslist.py
|
||||
#
|
||||
# Function: Shell-command for XMMS Song Change plugin.
|
||||
#
|
||||
# Author(s): Erik C. Thauvin (erik@thauvin.net)
|
||||
#
|
||||
# Copyright: Copyright (C) 2003 Erik C. Thauvin
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Source: Started anew.
|
||||
#
|
||||
# Notes: See the README file for more information.
|
||||
#
|
||||
# History:
|
||||
#
|
||||
# 2003-08-11 ECT Initial coding.
|
||||
#
|
||||
#
|
||||
# Disclaimer:
|
||||
#
|
||||
# This software is provided "as is" without express or implied warranties.
|
||||
# Permission is granted to use, copy, modify and distribute this software,
|
||||
# provided this disclaimer and copyright are preserved on all copies. This
|
||||
# software may not, however, be sold or distributed for profit, or included
|
||||
# with other software which is sold or distributed for profit, without the
|
||||
# permission of the author.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
import sys
|
||||
import re
|
||||
import cgi
|
||||
import urllib
|
||||
import time
|
||||
import os.path
|
||||
|
||||
# The script version number
|
||||
version='0.1'
|
||||
|
||||
# The output file
|
||||
playlist=os.path.expanduser('~/bin/playlist.txt')
|
||||
|
||||
# The maximum number of songs to keep in the playlist
|
||||
maxsongs=20
|
||||
|
||||
# The song search URL
|
||||
songsearch='http://www.lyricsstation.com/search.asp?R1=V1&txtSearch='
|
||||
|
||||
# The artist search URL
|
||||
bandsearch='"http://www.google.com/search?cat=gwd%2FTop%2FArts%2FMusic&q='
|
||||
|
||||
# The album search URL
|
||||
albumsearch='http://www.cduniverse.com/sresult.asp?HT_Search=TITLE&HT_Search_Info='
|
||||
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
# XMMS title format should be set to: %p -- %t -- %a
|
||||
# e.g.: The Artist -- The Song -- The Album
|
||||
m = re.search('(.*) -- (.*) -- (.*)', sys.argv[1])
|
||||
if m:
|
||||
|
||||
try:
|
||||
f = open(playlist, 'r')
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
except IOError:
|
||||
lines = ''
|
||||
|
||||
song = ''
|
||||
|
||||
# Song
|
||||
if len(m.group(2)) >= 1:
|
||||
song += '<tr valign="top"><td><a href="' + songsearch + urllib.quote_plus(m.group(2)) + '" target="_blank">' + cgi.escape(m.group(2)) + '</a></td>'
|
||||
else:
|
||||
song += '<td><font color="gray">n/a</font></td>'
|
||||
|
||||
song += '<td> </td>'
|
||||
|
||||
# Artist
|
||||
if len(m.group(1)) >= 1:
|
||||
song += '<td><a href=' + bandsearch + urllib.quote_plus('"' + m.group(1) + '"') + '" target="_blank">' + cgi.escape(m.group(1)) + '</a></td>'
|
||||
else:
|
||||
song += '<td><font color="gray">n/a</font></td>'
|
||||
|
||||
song += '<td> </td>'
|
||||
|
||||
# Album
|
||||
if len(m.group(3)) >= 1:
|
||||
song += '<td><a href="' + albumsearch + urllib.quote_plus(m.group(3)) + '" target="_blank">' + cgi.escape(m.group(3)) + '</a></td>'
|
||||
else:
|
||||
song += '<td><font color="gray">n/a</font></td>'
|
||||
|
||||
song += '</tr>\n'
|
||||
|
||||
f = open(playlist, 'w')
|
||||
f.write(song)
|
||||
|
||||
stop = len(lines) - 1
|
||||
if stop > 0:
|
||||
i = 1
|
||||
for line in lines:
|
||||
if song != line:
|
||||
f.write(line)
|
||||
i += 1
|
||||
if i >= maxsongs or i > stop:
|
||||
break
|
||||
|
||||
# Last Update
|
||||
f.write('<tr><td colspan="3" valign="bottom" align="left"><br><br><small>' + time.strftime('Updated on %B %d, %Y at %H:%M %Z') + '</small></td><td colspan="2" valign="bottom" align="right"><small><a href="http://www.thauvin.net/blog/stories.jsp?id=5#xmmslist" class="small" target="_blank">' + os.path.basename(sys.argv[0]) + '</a> ' + version + '</small></td></tr>\n')
|
||||
|
||||
f.close()
|
30
xmmslist.sh
Executable file
30
xmmslist.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# xmmslist.sh
|
||||
#
|
||||
# Transfers the xmmslist playlist to a Web server. See the README file for
|
||||
# more information.
|
||||
#
|
||||
# Copyright (C) 2003 Erik C. Thauvin. All rights reserved.
|
||||
#
|
||||
# This software is provided "as is" without express or implied warranties.
|
||||
#
|
||||
# Permission is granted to use, copy, modify and distribute this software,
|
||||
# provided this disclaimer and copyright are preserved on all copies. This
|
||||
# software may not, however, be sold or distributed for profit, or included
|
||||
# with other software which is sold or distributed for profit, without the
|
||||
# permission of the author.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
# The receiving host name
|
||||
RHOST="nix.thauvin.net"
|
||||
|
||||
# The receiving host location
|
||||
RLOC="/var/www/html/erik/tunez/"
|
||||
|
||||
if test -n "`ps -cx|grep xmms$`"; then
|
||||
# ncftpput -u user -p password ${RHOST} ${RLOC} ${HOME}/bin/playlist.txt
|
||||
scp -q ${HOME}/bin/playlist.txt ${RHOST}:${RLOC}
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue