rwdshell 0.97 → 0.98
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 +6 -0
- data/code/01rwdcore/01rwdcore.rb +4 -2
- data/code/01rwdcore/test_cases.rb +126 -0
- data/code/01rwdcore/test_harness.rb +15 -0
- data/code/01rwdcore/uploadreturns.rb +62 -0
- data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +14 -10
- data/configuration/language.dist +1 -1
- data/configuration/rwdapplicationidentity.dist +2 -2
- data/configuration/rwdshell.dist +2 -2
- data/configuration/rwdtinker.dist +2 -2
- data/configuration/tinkerwin2variables.dist +1 -1
- data/extras/zip/ioextras.rb +114 -0
- data/extras/zip/stdrubyext.rb +111 -0
- data/extras/zip/tempfile_bugfixed.rb +195 -0
- data/extras/zip/zip.rb +1377 -0
- data/extras/zip/zipfilesystem.rb +558 -0
- data/extras/zip/ziprequire.rb +61 -0
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.rwdshellbackwindow/46editscriptrecord.rwd +5 -5
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +12 -16
- data/init.rb +3 -0
- data/rwd_files/HowTo_Shell.txt +4 -0
- data/rwd_files/HowTo_Tinker.txt +14 -0
- data/rwdconfig.dist +6 -2
- data/tests/makedist.rb +16 -1
- metadata +12 -17
- data/extras/cmdline_parse +0 -47
- data/extras/config_file +0 -69
- data/extras/errorMsg +0 -19
- data/extras/makePlaylist +0 -34
- data/extras/mp3controld +0 -289
- data/extras/playlist +0 -186
- data/extras/showHelp +0 -18
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +0 -4
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +0 -3
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +0 -10
- data/installed/rwdtinkerwin2-0.5.inf +0 -8
data/extras/playlist
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
#!ruby
|
2
|
-
|
3
|
-
# --- Playlist class ---
|
4
|
-
#
|
5
|
-
# Author: Magnus Engstr�m
|
6
|
-
# Email: magnus@gisab.se
|
7
|
-
# File: playlist
|
8
|
-
#
|
9
|
-
# Description
|
10
|
-
# -----------
|
11
|
-
# The Playlist class handles everything a playlist should be able to manage.
|
12
|
-
# Shuffle it, unshuffle it, wrap it if desired, add new songs, find songs and
|
13
|
-
# so on. Cool huh? :)
|
14
|
-
# ----------------------
|
15
|
-
|
16
|
-
class Playlist
|
17
|
-
# create_from_file() creates a playlist from a file and returns either a Playlist instance or -1 in case of error
|
18
|
-
# This function should be used instead of the ::new, because this one
|
19
|
-
# returns -1 on file read errors, which the ::new doesn't.
|
20
|
-
def Playlist::create_from_file(filename)
|
21
|
-
# Check that the file is readable
|
22
|
-
if(FileTest::readable_real?(filename))
|
23
|
-
new(filename) # Return the Playlist class instance
|
24
|
-
else
|
25
|
-
-1 # Return -1 on error
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# initialize reads the playlist from a file and returns the Playlist instance
|
30
|
-
def initialize(filename)
|
31
|
-
|
32
|
-
@filename = filename # Store the filename for later use
|
33
|
-
@playlist = Array::new() # This hash contains the whole playlist
|
34
|
-
@index = 0 # Playlist's current position
|
35
|
-
@wrap = false # Don't repeat the list as default
|
36
|
-
|
37
|
-
# Parse these fields, separated with double pipes (||) (songname, artist, album, year, comment, tracknum, genre_id, genre)
|
38
|
-
File::foreach(filename) { |line| # Iterate through every line in the file
|
39
|
-
foo = line.split(/\|\|/)
|
40
|
-
@playlist << { "filename" => foo[0], "songname" => foo[1], "artist" => foo[2], "album" => foo[3], "year" => foo[4], "comment" => foo[5], "tracknum" => foo[6], "genre_id" => foo[7], "genre" => foo[8] } # Add a hash to the @playlist array with all values found in the playlist file
|
41
|
-
}
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
def insert(song, placement = 0)
|
46
|
-
# Check song information
|
47
|
-
return -1 if(song.type != Hash)
|
48
|
-
song = { "filename" => song["filename"], "songname" => song["songname"], "artist" => song["artist"], "album" => song["album"], "year" => song["year"], "comment" => song["comment"], "tracknum" => song["tracknum"], "genre_id" => song["genre_id"], "genre" => song["genre"] }
|
49
|
-
|
50
|
-
# Check minimum and maximum values
|
51
|
-
placement = 0 if(placement < 0)
|
52
|
-
placement = @playlist.length() if(placement > @playlist.length() )
|
53
|
-
|
54
|
-
# Retrieve the two parts of the split playlist
|
55
|
-
first = @playlist[0...placement]
|
56
|
-
second = @playlist[placement...@playlist.length()]
|
57
|
-
|
58
|
-
# Put it together again
|
59
|
-
@playlist = Array::new()
|
60
|
-
@playlist = first
|
61
|
-
@playlist << song
|
62
|
-
@playlist.concat(second)
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
def remove(placement = 0)
|
67
|
-
# Check boundaries
|
68
|
-
placement = 0 if(placement < 0)
|
69
|
-
placement = @playlist.length()-1 if( placement >= @playlist.length() )
|
70
|
-
|
71
|
-
# Delete the item
|
72
|
-
@playlist.delete_at(placement)
|
73
|
-
end
|
74
|
-
|
75
|
-
def find(search_string, case_insensitive = false, fields = ["songname", "filename"])
|
76
|
-
case_insensitive = nil if(case_insensitive == false)
|
77
|
-
|
78
|
-
results = Array::new()
|
79
|
-
regex = Regexp::new(search_string, case_insensitive) # The regex that will be matched
|
80
|
-
|
81
|
-
# Iterate through the playlist to find one or more matching songs
|
82
|
-
@playlist.length().times { |index|
|
83
|
-
# Iterate through the user supplied list of fields to be searched
|
84
|
-
fields.each { |field|
|
85
|
-
# Make sure this is a hash, so we don't go and crash, or make someone's dog sick :)
|
86
|
-
if(@playlist[index].type == Hash)
|
87
|
-
results << index if( regex.match(@playlist[index][field]) && !(results.include?(index)) ) # If it matches, and if it doesn't already is in the results. We don't want duplicates :)
|
88
|
-
end
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
results # Return the results
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
def shuffle()
|
97
|
-
# Iterate through the playlist
|
98
|
-
( 0...@playlist.length() ).each { |i|
|
99
|
-
j = rand @playlist.length() # Grab a random value between 0 and @playlist.length()
|
100
|
-
|
101
|
-
# Maintain index
|
102
|
-
if(@index == j)
|
103
|
-
@index = i
|
104
|
-
elsif(@index == i)
|
105
|
-
@index = j
|
106
|
-
end
|
107
|
-
|
108
|
-
@playlist[i], @playlist[j] = @playlist[j], @playlist[i]
|
109
|
-
}
|
110
|
-
end
|
111
|
-
|
112
|
-
def re_read()
|
113
|
-
# Maintain index
|
114
|
-
current_filename = @playlist[@index]["filename"]
|
115
|
-
|
116
|
-
# Create a new playlist array
|
117
|
-
@playlist = Array::new()
|
118
|
-
@index = 0
|
119
|
-
foo_index = 0 # Just to keep the count while adding all songs to the @playlist
|
120
|
-
|
121
|
-
# Parse these fields, separated with double pipes (||) (songname, artist, album, year, comment, tracknum, genre_id, genre)
|
122
|
-
# Iterate through every line in the file
|
123
|
-
File::foreach(@filename) { |line|
|
124
|
-
foo = line.split(/\|\|/) # Separate the fields with double pipes (||)
|
125
|
-
@playlist << { "filename" => foo[0], "songname" => foo[1], "artist" => foo[2], "album" => foo[3], "year" => foo[4], "comment" => foo[5], "tracknum" => foo[6], "genre_id" => foo[7], "genre" => foo[8] } # Add a hash to the @playlist array with all values found in the playlist file
|
126
|
-
|
127
|
-
# Maintain index
|
128
|
-
@index = foo_index if(foo[0] == current_filename)
|
129
|
-
foo_index += 1
|
130
|
-
}
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
def next()
|
135
|
-
# Increase the counter and return -1 if the playlist went to far, and wrap isn't true
|
136
|
-
@index += 1
|
137
|
-
if( @index >= @playlist.length() )
|
138
|
-
if(@wrap)
|
139
|
-
@index = 0
|
140
|
-
else
|
141
|
-
@index -= 1
|
142
|
-
-1 # Return an error
|
143
|
-
end
|
144
|
-
else
|
145
|
-
@index
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
def prev()
|
150
|
-
# Decrease the counter and return -1 if the playlist went to far, and wrap isn't true
|
151
|
-
@index -= 1
|
152
|
-
if( @index < 0 )
|
153
|
-
if(@wrap)
|
154
|
-
@index = @playlist.length() -1
|
155
|
-
else
|
156
|
-
@index += 1
|
157
|
-
-1 # Return an error
|
158
|
-
end
|
159
|
-
else
|
160
|
-
@index
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
def song_info(index = @index)
|
165
|
-
@playlist[index]
|
166
|
-
end
|
167
|
-
|
168
|
-
def goto(index = 0)
|
169
|
-
if( index >= 0 && index < @playlist.length() )
|
170
|
-
@index = index
|
171
|
-
else
|
172
|
-
return -1
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
def length()
|
177
|
-
@playlist.length()
|
178
|
-
end
|
179
|
-
|
180
|
-
def each()
|
181
|
-
@playlist.each { |song| yield(song) }
|
182
|
-
end
|
183
|
-
|
184
|
-
attr_reader :wrap, :index, :filename
|
185
|
-
attr_writer :wrap
|
186
|
-
end
|
data/extras/showHelp
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
# --- showHelp ----
|
4
|
-
#
|
5
|
-
# Author: Magnus Engstr�m
|
6
|
-
# Email: magnus@gisab.se
|
7
|
-
# File: showHelp
|
8
|
-
#
|
9
|
-
# Description
|
10
|
-
# -----------
|
11
|
-
# This function
|
12
|
-
# print the help
|
13
|
-
# message on STDOUT
|
14
|
-
# -----------------
|
15
|
-
|
16
|
-
def showHelp()
|
17
|
-
STDOUT.puts("MaGnuX Mp3 Management server - Ruby Edition v0.2a\n-------------------------------------------------\n\n--help\t\t\tShow this message\n--debug on\t\tShow some debug data\n--configfile file\tSelect configuration file\n--daemon, -D (yes*|no)\tGo to background on startup\n\n")
|
18
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# rwdwin2 - rwd applet in second window - core for Tinker: Applet adding/removing and Diagnostic tab
|
2
|
-
configuration/ab1tinkerwin2.cnf
|
3
|
-
code/xb1rwdtinkerbackwindow
|
4
|
-
gui/ll5rwdtinkerwin2selectiontab
|
5
|
-
gui/xb1rwdtinkerbackwindow
|
6
|
-
gui/uu6rwdtinkerwin2documents
|
7
|
-
gui/yg6rwdwin2helpabout
|
8
|
-
rwd_files/HowTo_TinkerWin2.txt
|