rwdaddresses 1.01 → 1.02
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.txt +5 -0
- data/code/01rwdcore/01rwdcore.rb +15 -13
- data/code/01rwdcore/openhelpwindow.rb +26 -26
- data/code/01rwdcore/returntomain.rb +8 -8
- data/code/01rwdcore/rwdtinkerversion.rb +12 -13
- data/code/01rwdcore/rwdwindowreturn.rb +3 -5
- data/code/01rwdcore/test_cases.rb +115 -0
- data/code/01rwdcore/test_harness.rb +12 -0
- data/code/01rwdcore/uploadreturns.rb +60 -59
- data/code/superant.com.rwdaddresses/attachtmpcontactphoto.rb +23 -23
- data/code/superant.com.rwdaddresses/clearscreendisplay.rb +14 -15
- data/code/superant.com.rwdaddresses/createnewnamerecord.rb +19 -18
- data/code/superant.com.rwdaddresses/deletecontactrecord.rb +22 -21
- data/code/superant.com.rwdaddresses/deleterwdaddressesupdatefiles.rb +15 -16
- data/code/superant.com.rwdaddresses/downloadrwdaddressfiles.rb +34 -32
- data/code/superant.com.rwdaddresses/listnamerecord.rb +14 -14
- data/code/superant.com.rwdaddresses/listvcardrecord.rb +15 -0
- data/code/superant.com.rwdaddresses/loadconfigurationrecord.rb +45 -44
- data/code/superant.com.rwdaddresses/loadconfigurationvariables.rb +14 -13
- data/code/superant.com.rwdaddresses/loadnamerecord.rb +29 -29
- data/code/superant.com.rwdaddresses/openhelpwindowrwdaddresses.rb +25 -25
- data/code/superant.com.rwdaddresses/renamecontact.rb +14 -15
- data/code/superant.com.rwdaddresses/returntomain.rb +8 -8
- data/code/superant.com.rwdaddresses/runaddresseswindow.rb +8 -8
- data/code/superant.com.rwdaddresses/runrwdaddressesmenu1.rb +31 -31
- data/code/superant.com.rwdaddresses/runrwdaddresssyncbackwindow.rb +8 -8
- data/code/superant.com.rwdaddresses/rwdaddressesbackwindow.rb +8 -8
- data/code/superant.com.rwdaddresses/rwdaddresseshelpabout.rb +10 -11
- data/code/superant.com.rwdaddresses/saveconfigurationrecord.rb +20 -20
- data/code/superant.com.rwdaddresses/savevcardrecord.rb +76 -0
- data/code/superant.com.rwdaddresses/syncrwdaddress.rb +24 -26
- data/code/superant.com.rwdaddresses/uploadrwdaddressfiles.rb +28 -28
- data/code/superant.com.rwdaddresses/viewaddressconfiguration.rb +21 -21
- data/code/superant.com.rwdaddresses/viewnamedata.rb +27 -26
- data/code/superant.com.rwdaddresses/viewphoto.rb +4 -4
- data/code/superant.com.rwdaddresses/viewrwdaddressesconfiguration.rb +23 -21
- data/code/superant.com.rwdaddresses/viewtmpcontactphoto.rb +6 -6
- data/code/superant.com.rwdaddresses/viewvcarddata.rb +22 -0
- data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +89 -92
- data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +15 -20
- data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -19
- data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +7 -7
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +48 -49
- data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +8 -7
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -26
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -31
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -13
- data/code/superant.com.rwdtinkerbackwindow/network.rb +82 -82
- data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -17
- data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +37 -37
- data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +20 -20
- data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +33 -32
- data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +8 -9
- data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +10 -11
- data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -20
- data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +23 -20
- data/configuration/language.dist +1 -1
- data/configuration/rwdaddresses.dist +2 -2
- data/configuration/rwdtinker.dist +2 -2
- data/configuration/tinkerwin2variables.dist +1 -1
- data/extras/vpim/date.rb +198 -0
- data/extras/vpim/dirinfo.rb +229 -0
- data/extras/vpim/enumerator.rb +29 -0
- data/extras/vpim/field.rb +497 -0
- data/extras/vpim/maker/vcard.rb +312 -0
- data/extras/vpim/rfc2425.rb +244 -0
- data/extras/vpim/rrule.rb +482 -0
- data/extras/vpim/time.rb +42 -0
- data/extras/vpim/vcard.rb +151 -0
- data/extras/vpim/vpim.rb +94 -0
- data/gui/frontwindow0/superant.com.rwdaddresses/16editrecord.rwd +5 -0
- data/gui/frontwindow0/superant.com.rwdaddresses/17viewvcardrecord.rwd +32 -0
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/70rwddiagnostics.rwd +1 -11
- data/init.rb +231 -228
- data/names/Angelina Jolie.vcf +8 -0
- data/rwd_files/HowTo_Addresses.txt +5 -0
- data/rwd_files/HowTo_Tinker.txt +14 -0
- data/rwdconfig.dist +6 -2
- data/tests/makedist.rb +36 -7
- metadata +23 -21
- 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/plugins/Network +0 -237
- data/extras/showHelp +0 -18
- data/gui/frontwindowselections/superant.com.rwdaddressesselectiontab/rwdaddressessyncselectiontab.rwd +0 -12
- 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/rwdaddressesdata2.inf +0 -8
- data/rwd_files/tinker.png +0 -0
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/plugins/Network
DELETED
@@ -1,237 +0,0 @@
|
|
1
|
-
#!ruby
|
2
|
-
require 'socket' # Network stuff
|
3
|
-
require 'timeout' # Timeout functions
|
4
|
-
|
5
|
-
class Network
|
6
|
-
|
7
|
-
def Network::start()
|
8
|
-
# Find configuration variables
|
9
|
-
host = $configFile.getParam('networkConfig', 'listenIP')
|
10
|
-
port = $configFile.getParam('networkConfig', 'listenPort')
|
11
|
-
|
12
|
-
# Create a socket to listen on and bind it to the host and port
|
13
|
-
begin
|
14
|
-
@socket = UDPSocket::new()
|
15
|
-
@socket.bind(host, port)
|
16
|
-
# Rescue the "Address in use" error
|
17
|
-
rescue Errno::EADDRINUSE
|
18
|
-
errorMsg("Network plugin: Port #{port} on host #{host} is already in use.")
|
19
|
-
return -1
|
20
|
-
# Rescue the "Address not available' error
|
21
|
-
rescue Errno::EADDRNOTAVAIL
|
22
|
-
errorMsg("Network plugin: Address #{host} is not available to bind.")
|
23
|
-
return -1
|
24
|
-
# Rescue "permission denied errors
|
25
|
-
rescue Errno::EACCES
|
26
|
-
errorMsg("Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?")
|
27
|
-
return -1
|
28
|
-
# Rescue all other errors
|
29
|
-
rescue
|
30
|
-
errorMsg("Network plugin: An error occured.")
|
31
|
-
return -1
|
32
|
-
# Rescue all other errors
|
33
|
-
end
|
34
|
-
|
35
|
-
# Get all acceptable hosts
|
36
|
-
hosts = $configFile.getParam('networkConfig', 'acceptHosts').split()
|
37
|
-
# Do some nice errorchecking
|
38
|
-
if(hosts.type != Array)
|
39
|
-
errorMsg("Network plugin: No hosts found in networkConfig/acceptHosts. Shutting down plugin.")
|
40
|
-
return -1 # Return the errorcode for plugin failure
|
41
|
-
end
|
42
|
-
|
43
|
-
# Main loop
|
44
|
-
while(true)
|
45
|
-
# Get data and client data from the client
|
46
|
-
data, info = @socket.recvfrom(256)
|
47
|
-
|
48
|
-
# Is this an acceptable IP address?
|
49
|
-
if(hosts.include?(info[2]) || hosts.include?(info[3]))
|
50
|
-
command, parameter = data.split(';')
|
51
|
-
|
52
|
-
# Command actions
|
53
|
-
command.downcase!()
|
54
|
-
case command
|
55
|
-
when 'next'
|
56
|
-
MP3Control::next_song()
|
57
|
-
|
58
|
-
when 'prev'
|
59
|
-
MP3Control::prev_song()
|
60
|
-
|
61
|
-
when 'play'
|
62
|
-
MP3Control::play()
|
63
|
-
|
64
|
-
when 'pause'
|
65
|
-
MP3Control::pause()
|
66
|
-
|
67
|
-
when 'stop'
|
68
|
-
MP3Control::stop()
|
69
|
-
|
70
|
-
when 'repeat', 'wrap'
|
71
|
-
if(parameter) # Make sure we actually DO have a parameter
|
72
|
-
if(parameter.downcase() == 'true' || parameter.downcase() == 'on' || parameter.downcase() == 'yes') # Positive?
|
73
|
-
$current_playlist.wrap = true # Do wrap
|
74
|
-
else
|
75
|
-
$current_playlist.wrap = false # Don't wrap
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
when 'random', 'shuffle'
|
80
|
-
if(parameter) # Make sure we actually DO have a parameter
|
81
|
-
if(parameter.downcase() == 'true' || parameter.downcase() == 'on' || parameter.downcase() == 'yes') # Positive?
|
82
|
-
$current_playlist.shuffle()
|
83
|
-
else
|
84
|
-
$current_playlist.re_read()
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
when 'die', 'terminate', 'quit'
|
89
|
-
errorMsg("Network plugin: Shutting down MaGnuX MP3 Control Server", 0)
|
90
|
-
|
91
|
-
when 'title'
|
92
|
-
@socket.send($current_playlist.song_info["songname"], 0, info[3], info[1].to_i)
|
93
|
-
|
94
|
-
when 'filename'
|
95
|
-
@socket.send($current_playlist.song_info["filename"], 0, info[3], info[1].to_i)
|
96
|
-
|
97
|
-
when 'time'
|
98
|
-
@socket.send(MP3Control::getTime('elapsed'), 0, info[3], info[1].to_i)
|
99
|
-
|
100
|
-
when 'timeleft'
|
101
|
-
@socket.send(MP3Control::getTime('left'), 0, info[3], info[1].to_i)
|
102
|
-
|
103
|
-
when 'totaltime'
|
104
|
-
@socket.send(MP3Control::getTime('total'), 0, info[3], info[1].to_i)
|
105
|
-
|
106
|
-
when 'playlist'
|
107
|
-
# Make sure we actually DO have a parameter
|
108
|
-
if(parameter)
|
109
|
-
playlist = $configFile.getParam(parameter, 'listFile')
|
110
|
-
|
111
|
-
# Check if the playlist entry exists
|
112
|
-
if(playlist.type != String)
|
113
|
-
errorMsg("The listFile entry for #{parameter} doesn't exist in #{$configFile.filename}! Please choose another playlist.")
|
114
|
-
else
|
115
|
-
# Make sure the playlist file exists and is readable
|
116
|
-
if( !FileTest::readable_real?(playlist) )
|
117
|
-
errorMsg("The playlist file (#{playlist}) doesn't exist. Please create it.")
|
118
|
-
# Everything seems to be in order. Create a new playlist
|
119
|
-
else
|
120
|
-
foo_playlist = Playlist::create_from_file(playlist)
|
121
|
-
# Do we have a new playlist?
|
122
|
-
if(foo_playlist.type == Playlist)
|
123
|
-
if(foo_playlist.length() > 0)
|
124
|
-
# Successful! Make this our current playlist!
|
125
|
-
$current_playlist = foo_playlist
|
126
|
-
$current_playlist_name = parameter
|
127
|
-
|
128
|
-
$current_playlist.wrap = true if($configFile.getParam(parameter, 'repeat') == 'true')
|
129
|
-
$current_playlist.shuffle() if($configFile.getParam(parameter, 'random') == 'true')
|
130
|
-
$current_playlist.goto(0) # Rewind the playlist
|
131
|
-
else
|
132
|
-
errorMsg("Playlist #{parameter} (#{playlist}) doesn't contain any entries.")
|
133
|
-
end
|
134
|
-
else
|
135
|
-
errorMsg("Playlist creation from playlist '#{parameter}' (#{playlist}) failed.")
|
136
|
-
end # Successfully created playlist?
|
137
|
-
end # End of "is readable" if-test
|
138
|
-
end # End of "playlist configfile section" if-test
|
139
|
-
|
140
|
-
end # Do we have a parameter?
|
141
|
-
|
142
|
-
when 'get_playlist'
|
143
|
-
if(parameter) # If user provided a parameter, send him all playlists available
|
144
|
-
res = Array::new()
|
145
|
-
$configFile.each_section { |section|
|
146
|
-
listFile = $configFile.getParam(section, 'listFile')
|
147
|
-
res << section if(listFile) # There is a value
|
148
|
-
}
|
149
|
-
@socket.send(res.join(' | '), 0, info[3], info[1].to_i)
|
150
|
-
else
|
151
|
-
# Find the playlist name. If it can't be found, return the filename
|
152
|
-
pl = ''
|
153
|
-
$configFile.each_section { |section|
|
154
|
-
listFile = $configFile.getParam(section, 'listFile')
|
155
|
-
pl = section if(listFile == $current_playlist.filename) # There is a value
|
156
|
-
}
|
157
|
-
if(pl != '')
|
158
|
-
@socket.send(pl, 0, info[3], info[1].to_i)
|
159
|
-
else
|
160
|
-
@socket.send($current_playlist.filename, 0, info[3], info[1].to_i)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
when 'find'
|
165
|
-
# Make sure we DO have a parameter
|
166
|
-
if(parameter)
|
167
|
-
|
168
|
-
# Create variables
|
169
|
-
result = Array::new()
|
170
|
-
lastIndex = 0
|
171
|
-
parameter, fields = parameter.split(/\|\|/)
|
172
|
-
fields = fields.split(/,/) if(fields)
|
173
|
-
|
174
|
-
fields = ["filename", "songname"] if(!fields)
|
175
|
-
|
176
|
-
# Find all songs that match this
|
177
|
-
$current_playlist.find(parameter, true, fields).each { |index|
|
178
|
-
songname = $current_playlist.song_info(index)["songname"]
|
179
|
-
filename = $current_playlist.song_info(index)["filename"]
|
180
|
-
result << "#{songname} [#{filename}] [#{index}]"
|
181
|
-
lastIndex = index
|
182
|
-
}
|
183
|
-
|
184
|
-
puts("Search finished") if($commandline["--verbose"] == 'on')
|
185
|
-
|
186
|
-
# More than one song matched?
|
187
|
-
if(result.length() == 1)
|
188
|
-
$current_playlist.goto(lastIndex)
|
189
|
-
MP3Control::play()
|
190
|
-
end
|
191
|
-
if(result.join(' | ').length < 65535)
|
192
|
-
@socket.send(result.join(' | '), 0, info[3], info[1].to_i)
|
193
|
-
else
|
194
|
-
while(result.join(' | ').length > 65535)
|
195
|
-
result = result[0..(result.length-100)]
|
196
|
-
puts("Removing search results...") if($commandline["--verbose"] == 'on')
|
197
|
-
end
|
198
|
-
@socket.send(result.join(' | '), 0, info[3], info[1].to_i)
|
199
|
-
end
|
200
|
-
|
201
|
-
end # End of the "have parameter" if
|
202
|
-
|
203
|
-
when '5b'
|
204
|
-
MP3Control::backward(5)
|
205
|
-
|
206
|
-
when '5f'
|
207
|
-
MP3Control::forward(5)
|
208
|
-
|
209
|
-
when 'index'
|
210
|
-
if(parameter) # User supplied us with a parameter. Go to that index.
|
211
|
-
$current_playlist.goto(parameter.to_i)
|
212
|
-
else
|
213
|
-
@socket.send($current_playlist.index.to_s, 0, info[3], info[1].to_i)
|
214
|
-
end
|
215
|
-
|
216
|
-
when 'length'
|
217
|
-
@socket.send($current_playlist.length.to_s, 0, info[3], info[1].to_i)
|
218
|
-
|
219
|
-
when 'info'
|
220
|
-
if(parameter) # Make sure we actually DO have a parameter
|
221
|
-
res = $current_playlist.song_info(parameter.to_i)
|
222
|
-
if(res.type == Hash) # Make sure there is a result
|
223
|
-
# songname, artist, album, year, comment, tracknum, genre_id, genre
|
224
|
-
@socket.send("#{res["filename"]} | #{res["songname"]} | #{res["artist"]} | #{res["album"]} | #{res["year"]} | #{res["comment"]} | #{res["tracknum"]} | #{res["genre_id"]} | #{res["genre"]}", 0, info[3], info[1].to_i)
|
225
|
-
else
|
226
|
-
@socket.send("Index out of bounds", 0, info[3], info[1].to_i)
|
227
|
-
end # End of result check
|
228
|
-
end # Parameter check
|
229
|
-
|
230
|
-
end # case command
|
231
|
-
|
232
|
-
end # Access control if
|
233
|
-
end # while(true)
|
234
|
-
|
235
|
-
end # Network::start()
|
236
|
-
|
237
|
-
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
|
data/rwd_files/tinker.png
DELETED
Binary file
|