#!/usr/bin/python3

import os
import urllib
from lxml import etree

os.chdir(os.path.expanduser('~/stash/music'))
playlists = os.path.expanduser('~/.local/share/rhythmbox/playlists.xml')
playlists = etree.parse(playlists)
playlist = playlists.findall('.//playlist[@name="phone"]/location')
command = ['rsync','-avR','booph.local:stash/music/']
for url in playlist: command.insert(-1,os.path.relpath(urllib.url2pathname(url.text)[7:]))
os.spawnvp(os.P_WAIT,'rsync',command)
