;iPod Transfer by Matt5150
;version 1.2
alias ipod dialog -m ipod ipod
dialog ipod {
title "iPod Transfer v1.2"
size -1 -1 500 385
box "iPod Path", 1, 5 5 370 42
edit "F:\iPod_Control\Music\", 2, 10 20 300 20, autohs
button "Load", 3, 320 20 50 20
list 4, 5 50 490 300
edit "Songs: n\a", 5, 380 20 100 20, read disable
box "Transfer to", 6, 5 340 370 42
edit "C:\Users\Matteo\Music", 7, 10 355 300 20, autohs
button "Copy", 8, 320 355 50 20
button "Close", 9, 425 355 70 20
}
on *:dialog:ipod:*:*:{
if ($devent == init) {
dmdx SetMircVersion $version
dmdx MarkDialog $dname
dmdx SetControlMDX $dname 4 ListView grid sortascending report rowselect labeltip checkboxes > $dmdx(.).views
did -i $dname 4 1 headerdims 100:1 150:2 150:3 60:4
did -i $dname 4 1 headertext + 0 Artist $chr(9) Title $chr(9) Album $chr(9) File
;carica.ipod.dir
}
if ($devent = sclick) {
if ($did = 3) { carica.ipod.dir }
if ($did = 8) { copia.file.list }
}
}
alias dmdx {
if ($prop) && ($prop = views) { return $shortfn($scriptdir $+ views.mdx) }
else { dll $shortfn($scriptdir $+ mdx.dll) $1- }
}
alias carica.ipod.dir {
var %.path.dir = $did(ipod,2)
did -r ipod 4
if (!$disk($left(%.path.dir,2))) { noop $input($left(%.path.dir,2) - Disk not found,o,Error) | halt }
if (!$isdir(%.path.dir)) { noop $input(%.path.dir - Dir doesnt exist,o,Error) | halt }
noop $findfile(%.path.dir,*.mp3,0,carica.file.dialog $1-)
}
alias carica.file.dialog {
var %.filename = $1-
did -a ipod 4 $sound(%.filename).artist $chr(9) $sound(%.filename).title $chr(9) $sound(%.filename).album $chr(9) %.filename
did -ar ipod 5 Songs: $calc($did(ipod,4).lines -1)
}
alias copia.file.list {
var %.file = $did(ipod,4).lines
while (%.file) {
if ($gettok($did(ipod,4,%.file),5,32) = 2) { copia.file $did(ipod,4,%.file) }
dec %.file
}
}
alias copia.file {
if (!$isdir($qt($did(ipod,7)))) { noop $input($did(ipod,7) - Dir doesnt exist,o,Error) | halt }
var %.copy = $1-, %.directory = $did(ipod,7)
var %.artist = $mkfn($gettok($gettok(%.copy,1,9),6-,32)), %.title = $mkfn($gettok($gettok(%.copy,2,9),5-,32)), %.album = $mkfn($gettok($gettok(%.copy,3,9),5-,32))
if (!%.title) { var %.title = unknown }
if (!%.artist) { var %.artist = unknown }
if (!%.album) { var %.album = unknown }
if (!$finddir(%.directory,%.artist $+ \ $+ %.album $+ \,1)) { mkdir $qt(%.directory $+ \ $+ %.artist $+ \ $+ %.album $+ \) }
copy -o $qt($gettok($gettok(%.copy,4,9),5-,32)) $qt(%.directory $+ \ $+ %.artist $+ \ $+ %.album $+ \ $+ %.artist - %.title $+ .mp3)
}