rwdshell 0.95 → 0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Readme.txt +5 -1
- data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +25 -26
- data/code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb +25 -4
- data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +1 -0
- data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +6 -7
- data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +12 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +2 -2
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -7
- data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +3 -0
- data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +24 -0
- data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +1 -1
- data/configuration/rwdshellversion.cnf +1 -1
- data/configuration/rwdtinker.cnf +0 -3
- data/configuration/rwdtinkerversion.cnf +1 -1
- data/configuration/tinkerwin2variables.cnf +5 -1
- data/extras/cmdline_parse +47 -0
- data/extras/config_file +69 -0
- data/extras/errorMsg +19 -0
- data/extras/makePlaylist +34 -0
- data/extras/mp3controld +289 -0
- data/extras/playlist +186 -0
- data/extras/showHelp +18 -0
- data/gui/00coreguibegin/applicationguitop.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/40rwdlistzips.rwd +9 -10
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/45installremotezip.rwd +44 -0
- data/init.rb +22 -35
- data/installed/rwdtinkerwin2-0.5.inf +8 -0
- data/installed/rwdviewlogo-0.4.inf +4 -0
- data/rwd_files/HowTo_Shell.txt +5 -1
- data/rwd_files/HowTo_Tinker.txt +17 -1
- data/tests/rwdtinkertestEN.rb +163 -0
- data/tests/test.result +32 -0
- metadata +20 -14
- data/gui/frontwindowtdocuments/superant.com.shelldocument/vvdocshellxp.rwd +0 -5
- data/lang/alanguagehashbegin.rb +0 -4
- data/lang/languagehash.rb +0 -4
- data/lang/templangfile.rb +0 -16
- data/lang/vlanguagehashend.rb +0 -6
- data/lang/wlocallangstart.rb +0 -5
- data/lang/xlocallangfile.rb +0 -16
- data/lang/zlocallangend.rb +0 -2
- data/zips/rwdwcalc-0.50.zip +0 -0
data/Readme.txt
CHANGED
@@ -193,13 +193,17 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
|
|
193
193
|
Thanks, Steven Gibson
|
194
194
|
|
195
195
|
== Changelog
|
196
|
+
version 0.96
|
197
|
+
updated for rwdtinker 1.56
|
198
|
+
first debian version
|
199
|
+
|
196
200
|
version 0.95
|
197
201
|
added ruby script running
|
198
202
|
add back window for more control tabs
|
199
203
|
beginning of context sensitive help
|
200
204
|
wider text boxes for configuration information
|
201
205
|
updated for rwdtinker 1.51 - finds available port and remote control
|
202
|
-
updated for rwdtinker 1.52 -
|
206
|
+
updated for rwdtinker 1.52 - can install applets from Gems
|
203
207
|
|
204
208
|
version 0.94
|
205
209
|
updated for rwdtinker 1.44 - refactor gui directory structure
|
@@ -1,28 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# Bind message passing socket to rwdtinker application
|
2
2
|
|
3
3
|
def runcontrolcommand
|
4
4
|
require 'socket'
|
5
5
|
|
6
6
|
# Change this line...
|
7
|
-
ip = '127.0.0.1'
|
7
|
+
ip = '127.0.0.1'
|
8
8
|
# And this one...
|
9
|
-
port = $rwdcontrolport1
|
10
|
-
if @a_remoteportinput
|
11
|
-
port = @a_remoteportinput.to_i
|
12
|
-
end
|
13
|
-
# Done!
|
9
|
+
port = $rwdcontrolport1
|
10
|
+
if @a_remoteportinput
|
11
|
+
port = @a_remoteportinput.to_i
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
14
|
commandtext = @a_remotecommandinput.to_s
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
client = UDPSocket::new()
|
21
|
-
client.send(commandtext, 0, ip, port)
|
22
|
-
|
23
|
-
|
24
|
-
if (commandtext == "stop")
|
25
|
-
begin
|
15
|
+
remotehostnotfound = true
|
16
|
+
if (commandtext == "stop")
|
17
|
+
begin
|
18
|
+
client = UDPSocket::new()
|
19
|
+
client.send(commandtext, 0, ip, port)
|
26
20
|
@socket = UDPSocket::new()
|
27
21
|
@socket.bind(ip, port)
|
28
22
|
# Rescue the "Address in use" error
|
@@ -51,17 +45,20 @@ begin
|
|
51
45
|
@remotecommandresult = "Remote Host not running"
|
52
46
|
end
|
53
47
|
@socket.close
|
54
|
-
|
48
|
+
# Close the socket after use
|
49
|
+
client.close()
|
50
|
+
end
|
55
51
|
|
56
|
-
remotehostnotfound = true
|
57
|
-
if (commandtext == "query")
|
58
|
-
begin
|
52
|
+
remotehostnotfound = true
|
53
|
+
if (commandtext == "query")
|
54
|
+
begin
|
55
|
+
client = UDPSocket::new()
|
56
|
+
client.send(commandtext, 0, ip, port)
|
59
57
|
@socket = UDPSocket::new()
|
60
58
|
@socket.bind(ip, port)
|
61
59
|
# Rescue the "Address in use" error
|
62
60
|
rescue Errno::EADDRINUSE
|
63
61
|
|
64
|
-
|
65
62
|
databack, info = client.recv(128)
|
66
63
|
@remotecommandresult = databack
|
67
64
|
@lastremotecommand = "rwdtinker remote: Port #{port} on host #{ip} "
|
@@ -82,15 +79,17 @@ begin
|
|
82
79
|
# Rescue all other errors
|
83
80
|
end
|
84
81
|
@socket.close
|
85
|
-
|
86
|
-
if remotehostnotfound
|
87
|
-
@remotecommandresult = "Remote Host not running"
|
88
|
-
end
|
82
|
+
|
89
83
|
# Close the socket after use
|
90
84
|
client.close()
|
85
|
+
end
|
91
86
|
|
87
|
+
if remotehostnotfound
|
88
|
+
@remotecommandresult = "Remote Host not running"
|
89
|
+
end
|
92
90
|
end
|
93
91
|
|
92
|
+
# list the remote control options on the screen
|
94
93
|
def showremoteportoptions
|
95
94
|
|
96
95
|
@remoteportoptions = $rwdcontrolports.rwd_options
|
@@ -1,11 +1,15 @@
|
|
1
|
-
|
1
|
+
# help text files used by context sensitive help
|
2
2
|
|
3
3
|
Helptext.update( :tinkerwin2_help => " You can view the list of applets you can install
|
4
4
|
by clicking on the list files button
|
5
5
|
|
6
6
|
You can download an applet created by someone else
|
7
7
|
|
8
|
-
put the file in the zips directory
|
8
|
+
put the file in the zips directory
|
9
|
+
|
10
|
+
rwdtinker applets packaged as RubyGems can be used if you have RubyGems installed.
|
11
|
+
You can download rwdtinker gems at the 'Install Remote Applets' tab
|
12
|
+
",
|
9
13
|
:applet_viewing => "You can get a list of all installed applets by clicking the 'listfiles button'
|
10
14
|
To see the text of a install file
|
11
15
|
Type in the name of the file you want.
|
@@ -32,6 +36,23 @@
|
|
32
36
|
:applet_tinkerbackeditconfiguration => " You can edit the configuration
|
33
37
|
|
34
38
|
Remember to reload the configuration variables if you want your
|
35
|
-
changes used."
|
36
|
-
|
39
|
+
changes used.",
|
40
|
+
:remotegemapplet_install => " To download and install use the 'Install Remote Applets'
|
41
|
+
|
42
|
+
First click on 'List applets in the Remote GEM Repository available for downloading'
|
43
|
+
then go to the very bottom to click on the applet you want
|
44
|
+
then on the top click 'install remote Gem applet package'
|
45
|
+
|
46
|
+
This installs the package in the Gem system
|
47
|
+
You still need to install it into rwdtinker - do that in the 'List Zips' tab
|
48
|
+
|
49
|
+
For this feature to work, you need
|
50
|
+
RubyGems installed
|
51
|
+
Variables set correctly in the tinerwin2.cnf file
|
52
|
+
$xpcommand, $gemdirectory_withgemfiles and $geminstalled_directory
|
53
|
+
the defaults as shipped will normally be for a Debian Linux system
|
54
|
+
On Debian Linux, you would usually need to be running rwdtinker as root in order to install RubyGems
|
55
|
+
|
56
|
+
You can view the list of rwdtinker applets you have installed already by clicking 'view already installed GEM applets'
|
57
|
+
"
|
37
58
|
)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# install rwdtinker applet from a long directory location
|
1
2
|
def installgemapplet
|
2
3
|
require 'fileutils'
|
3
4
|
require 'extras/zip/zip'
|
@@ -6,16 +7,14 @@
|
|
6
7
|
begin # exception trapped block
|
7
8
|
fullname = nametext + ".zip"
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
zf.extract(entry.to_s, entry.to_s)
|
10
|
+
zf = Zip::ZipFile.new(fullname)
|
11
|
+
zf.sort.each {
|
12
|
+
|entry|
|
13
|
+
zf.extract(entry.to_s, entry.to_s)
|
14
14
|
}
|
15
|
-
|
15
|
+
@installapplettext = Message[:applet_installed]
|
16
16
|
|
17
17
|
rescue
|
18
18
|
@installapplettext = "unzip error - applet may not be installed correctly"
|
19
19
|
end # exception rescue
|
20
|
-
|
21
20
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# download gem of rwdtinker applet
|
2
|
+
def superantcominstallremotegemapplet
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
tempnametext = "%s" % [@superantcominstallremoteappletinput]
|
6
|
+
temparray = tempnametext.split(/ /)
|
7
|
+
nametext = temparray[0]
|
8
|
+
begin # exception trapped block
|
9
|
+
|
10
|
+
|
11
|
+
commandline = $xpcommand + "gem install " + nametext
|
12
|
+
|
13
|
+
@superantcominstallremotegemappletresult = `#{commandline}`
|
14
|
+
|
15
|
+
rescue
|
16
|
+
@superantcominstallremotegemappletresult = "error during gem install!"
|
17
|
+
end # exception rescue
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# this code is to list the gem directories that are installed
|
2
|
+
def superantcomshowgemfiledirs
|
3
|
+
|
4
|
+
fileList = Dir.new($gemdirectory_withgemfiles).entries.sort.delete_if { |x| ! (x =~ /\Arwdzip/) }
|
5
|
+
@superantcomshowgemappletdirsresult = fileList.rwd_method("superantcomshowgemappletdirsname")
|
6
|
+
end
|
7
|
+
|
8
|
+
def superantcomshowgemappletdirsname(inffile)
|
9
|
+
applet = inffile
|
10
|
+
@a_gemfiledirsinput = applet
|
11
|
+
|
12
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# this code is to list the zips
|
2
2
|
|
3
3
|
|
4
|
-
def
|
4
|
+
def fillzipappletname(inffile)
|
5
5
|
applet = inffile.gsub(/\.zip$/, "")
|
6
6
|
@a_installapplet = applet
|
7
7
|
|
@@ -50,5 +50,5 @@ def listgemzips
|
|
50
50
|
findzipfiles(x + "/**")
|
51
51
|
end
|
52
52
|
end
|
53
|
-
@zipslistresult = $zipsarray.rwd_method("
|
53
|
+
@zipslistresult = $zipsarray.rwd_method("fillzipappletname")
|
54
54
|
end
|
@@ -1,16 +1,31 @@
|
|
1
1
|
# this code is to list the zipped applets that can be installed
|
2
|
-
|
3
|
-
if File.exist?($zipslocation)
|
4
|
-
fileList = Dir.new($zipslocation).entries.sort.delete_if { |x| ! (x =~ /zip$/) }
|
5
|
-
@zipslistresult = fileList.rwd_method("fillziptoinstallname")
|
6
|
-
end
|
7
|
-
end
|
2
|
+
|
8
3
|
|
9
4
|
def fillziptoinstallname(inffile)
|
10
5
|
applet = inffile.gsub(/\.zip$/, "")
|
11
6
|
@a_installapplet = applet
|
12
7
|
|
13
8
|
end
|
9
|
+
|
14
10
|
|
15
11
|
|
16
|
-
|
12
|
+
|
13
|
+
def listzipfilestoinstall
|
14
|
+
startlangdir = File.join($progdir, $zipslocation )
|
15
|
+
#get a list of the files and subdirectories on the starting directory only
|
16
|
+
|
17
|
+
|
18
|
+
a = Array.new(Dir["#{startlangdir}/*"].entries.sort)
|
19
|
+
|
20
|
+
#loop through and get the files names
|
21
|
+
a.each do |x|
|
22
|
+
# only zip files
|
23
|
+
if x =~ /\.zip/
|
24
|
+
# puts "#{x}" #adds the file to the array to display on the screen
|
25
|
+
$zipsarraylocal = $zipsarraylocal | ["#{x}"]
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
@zipslistresult = $zipsarraylocal.rwd_method("fillziptoinstallname")
|
31
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This tinker method is to retrieve the list of rwdzip applets available to install from the remote repository
|
2
|
+
|
3
|
+
def superantcomremotegemlist
|
4
|
+
gemcommandoption = "search --remote "
|
5
|
+
gemfilename = "rwdzip"
|
6
|
+
commandtext = "gem search --remote rwdzip"
|
7
|
+
commandtemp = $xpcommand + commandtext
|
8
|
+
begin # exception trapped block
|
9
|
+
|
10
|
+
tempremotegemappletsresult = `#{commandtemp} 2>&1`
|
11
|
+
@superantcomremotegemappletsfullresult = tempremotegemappletsresult
|
12
|
+
fileList = tempremotegemappletsresult.split(/\n/).delete_if { |x| ! (x =~ /\Arwdzip/) }
|
13
|
+
|
14
|
+
@superantcomremotegemappletsresult = fileList.rwd_method("superantcomremotegemappletdirsname")
|
15
|
+
rescue SystemCallError, StandardError
|
16
|
+
@superantcomremotegemappletsresult = "system call error: " + $!
|
17
|
+
end # exception rescue
|
18
|
+
end
|
19
|
+
|
20
|
+
def superantcomremotegemappletdirsname(inffile)
|
21
|
+
applet = inffile
|
22
|
+
@superantcominstallremoteappletinput = applet
|
23
|
+
|
24
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
RwdShellVersion = "0.
|
2
|
+
RwdShellVersion = "0.96"
|
data/configuration/rwdtinker.cnf
CHANGED
@@ -2,11 +2,8 @@
|
|
2
2
|
ConfigurationDir = "configuration" # for use in program - init.rb has this value without using this constant
|
3
3
|
CodeName = "rwdtinker"
|
4
4
|
CodeNameFile = CodeName + ".rb"
|
5
|
-
LangNameFile = "rwdlanguage.rb"
|
6
5
|
RWDFile = "rwdtinker.rwd"
|
7
6
|
LangDir = "lang"
|
8
|
-
TempLangHashFile = LangDir + "/" + "templangfile.rb"
|
9
|
-
LocalLangHashFile = LangDir + "/" + "xlocallangfile.rb"
|
10
7
|
CodeDir = "code"
|
11
8
|
GuiDir = "gui"
|
12
9
|
$help_topic = "general_help"
|
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
RwdTinkerVersion = "1.
|
2
|
+
RwdTinkerVersion = "1.56"
|
@@ -1,7 +1,11 @@
|
|
1
1
|
|
2
2
|
TinkerWin2ConfigurationFileName = "tinkerwin2variables.cnf" # this file name - do not change
|
3
3
|
$zipslocation = "zips" # location of applets to add
|
4
|
-
$zipsarray = [""]
|
4
|
+
$zipsarray = [""] ; $zipsarraylocal = [""]
|
5
|
+
$xpcommand = " " # Linux machines
|
6
|
+
# $xpcommand = "cmd /C " # XP machines with cmd shell
|
7
|
+
$gemdirectory_withgemfiles = "/usr/lib/ruby/gems/1.8/gems"
|
8
|
+
# $gemdirectory_withgemfiles = "c:\\ruby\\lib\\ruby\\gems\\1.8\\gems" # XP machine
|
5
9
|
# $geminstalled_directory = "/ruby/lib/ruby/gems/1.8/gems" # XP machine
|
6
10
|
$geminstalled_directory = "/usr/lib/ruby/gems/1.8/gems" # Debian Linux
|
7
11
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# --- Parse command line ---
|
3
|
+
#
|
4
|
+
# Author: Magnus Engstr�m
|
5
|
+
# Email: magnus@gisab.se
|
6
|
+
# File: cmdline_parse
|
7
|
+
#
|
8
|
+
# Description
|
9
|
+
# -----------
|
10
|
+
# Parses the commandline and
|
11
|
+
# returns a hash with the
|
12
|
+
# switch as key and the
|
13
|
+
# value as value :)
|
14
|
+
# --------------------------
|
15
|
+
|
16
|
+
class Commandline
|
17
|
+
def Commandline::parse()
|
18
|
+
|
19
|
+
params = Hash::new() # Could be useful to have something to put the commandline in ;)
|
20
|
+
key = false # Just a really ugly hack to keep track on if we're reading key or value
|
21
|
+
foo = '' # Keeps the key name
|
22
|
+
|
23
|
+
# Iterate through the command line ($*) and put it in the params hash
|
24
|
+
$*.each { |param|
|
25
|
+
key = ( key == true ? false : true ) # Negate the value of key
|
26
|
+
if(key)
|
27
|
+
foo = param
|
28
|
+
else
|
29
|
+
params[foo] = param
|
30
|
+
end
|
31
|
+
}
|
32
|
+
|
33
|
+
# Validate the command line.
|
34
|
+
# Every key should begin with at least one '-' and have a value
|
35
|
+
if( !key ) # If key equals true, then the user should enter one more parameter
|
36
|
+
passed = true
|
37
|
+
params.each { |key, value| # Iterate through all parameters
|
38
|
+
passed = false if(key[0].chr() != '-') # Doesn't it start with a '-'? Not passed...
|
39
|
+
passed = false if(value == '') # I really want a value here, not just an empty string
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Return params if check passed, else return -1
|
44
|
+
passed ? params : -1
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
data/extras/config_file
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
#!ruby
|
2
|
+
require 'ftools'
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
class ConfigFile
|
6
|
+
|
7
|
+
def ConfigFile::parse(filename)
|
8
|
+
# Make sure this file exists and is readable
|
9
|
+
if( FileTest::readable_real?(filename) )
|
10
|
+
new(filename) # Return the class instance
|
11
|
+
else
|
12
|
+
-1 # Return -1 on failure
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(filename)
|
17
|
+
@filename = filename
|
18
|
+
@config = Hash::new() # The class internal variable that holds the config data
|
19
|
+
section = ''
|
20
|
+
|
21
|
+
# Parse the configuration file (and in only TWO rows, God I love Ruby! =)
|
22
|
+
IO::foreach(@filename) { |configLine| @config[section = $1] = Hash::new() if(configLine.gsub(/\s*#.*$/, '') =~ /\s*(\S+)\s*\{/)
|
23
|
+
@config[section].update({$1 => $2}) if(configLine.gsub(/\s*#.*$/, '') =~ /\s*(\S+)\s*=\s*(.*)/) }
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return the requested parameter
|
27
|
+
def getParam(section, parameter)
|
28
|
+
@config[section][parameter] if(@config[section].type == Hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Set the provided parameter
|
32
|
+
def setParam(section, parameter, value)
|
33
|
+
# Create a temp file
|
34
|
+
temp = Tempfile::new('config')
|
35
|
+
|
36
|
+
current_section = ''
|
37
|
+
# Loop through the config file
|
38
|
+
IO::foreach(@filename) { |line|
|
39
|
+
current_section = $1 if( line =~ /^\s*(\S+)\s*{\s*(#.*)?$/ ) # Handle the section stuff
|
40
|
+
# Is this a correct parameter entry?
|
41
|
+
if( line =~ /^\s*(\S+)\s*=\s*\S+\s*(#.*)?$/ )
|
42
|
+
|
43
|
+
if( current_section == section && $1 == parameter ) # This is the line we want to change!
|
44
|
+
line.gsub!( /^(\s*\S+\s*=\s*)\S+(\s*(#.*)?)$/, "\\1#{value}\\2" ) # Change the parameter value to the one the user supplied
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
temp.puts(line) # Write the line to the tempfile
|
50
|
+
}
|
51
|
+
|
52
|
+
temp.close() # Close the file
|
53
|
+
File::copy(temp.path, @filename) # Copy the tempfile to overwrite the old one
|
54
|
+
temp.close(true) # Remove the file
|
55
|
+
end
|
56
|
+
|
57
|
+
# Loop through all sections
|
58
|
+
def each_section()
|
59
|
+
@config.each { |key,value| yield(key) }
|
60
|
+
end
|
61
|
+
|
62
|
+
# Loop through all parameters in a section
|
63
|
+
def each_parameter(section)
|
64
|
+
@config[section].each { |key,value| yield(key) }
|
65
|
+
end
|
66
|
+
|
67
|
+
attr_reader :filename
|
68
|
+
|
69
|
+
end
|
data/extras/errorMsg
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!ruby
|
2
|
+
|
3
|
+
# --- errorMsg ---
|
4
|
+
#
|
5
|
+
# Author: Magnus Engstr�m
|
6
|
+
# Email: magnus@gisab.se
|
7
|
+
# File: errorWrite
|
8
|
+
#
|
9
|
+
# Description
|
10
|
+
# -----------
|
11
|
+
# Outputs an error message to the administrator
|
12
|
+
# ------------------
|
13
|
+
|
14
|
+
def errorMsg(message, exitapp = false)
|
15
|
+
STDERR.puts(message)
|
16
|
+
MP3Control::exit_mpg123() if(exitapp)
|
17
|
+
Kernel::exit(exitapp) if(exitapp) # Terminate application and return the exitapp value if it isn't falsew
|
18
|
+
|
19
|
+
end
|
data/extras/makePlaylist
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'mp3tag'
|
3
|
+
|
4
|
+
def getList(dir)
|
5
|
+
Dir::chdir(dir)
|
6
|
+
|
7
|
+
# Find the files in this directory
|
8
|
+
Dir['*mp3'].each { |file|
|
9
|
+
if(FileTest::file?(file))
|
10
|
+
mp3tag = Mp3Tag::new(Dir::getwd()+"/"+file)
|
11
|
+
if(mp3tag.songname.length > 0)
|
12
|
+
puts("#{Dir::getwd()+"/"+file}||#{mp3tag.songname}||#{mp3tag.artist}||#{mp3tag.album}||#{mp3tag.year}||#{mp3tag.comment}||#{mp3tag.tracknum}||#{mp3tag.genre_id}||#{mp3tag.genre}")
|
13
|
+
else
|
14
|
+
name = Dir::getwd()+"/"+file
|
15
|
+
name =~ /([^\/]+)\.mp3$/
|
16
|
+
puts("#{Dir::getwd()+"/"+file}||#{$1}||#{mp3tag.artist}||#{mp3tag.album}||#{mp3tag.year}||#{mp3tag.comment}||#{mp3tag.tracknum}||#{mp3tag.genre_id}||#{mp3tag.genre}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
}
|
20
|
+
|
21
|
+
Dir['*'].each { |entry|
|
22
|
+
if(FileTest::directory?(entry))
|
23
|
+
getList(entry)
|
24
|
+
end
|
25
|
+
}
|
26
|
+
Dir::chdir('..')
|
27
|
+
end
|
28
|
+
|
29
|
+
# Change current directory to user supplied one
|
30
|
+
Dir::chdir(ARGV[0])
|
31
|
+
getList(ARGV[0])
|
32
|
+
|
33
|
+
#song = Mp3Tag::new(ARGV[0])
|
34
|
+
#puts song.songname()
|