Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f4be726d
Kaydet (Commit)
f4be726d
authored
Nis 15, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changed status format; added host argument; documented arguments;
fixed code for missing frame argument.
üst
b108e976
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
21 deletions
+30
-21
sendcd.py
Demo/sgi/cd/sendcd.py
+30
-21
No files found.
Demo/sgi/cd/sendcd.py
Dosyayı görüntüle @
f4be726d
# Read CD audio data from the SCSI CD player and send it as UDP
# packets to "readcd.py" on another host.
# Option:
# "-l" lists track info and quits.
# "-s" displays status and quits.
# packets to "recvcd.py" on another host.
#
# Usage: python sendcd.py [options] host [track | minutes seconds [frames]]
#
# Options:
# "-l" list track info and quit.
# "-s" display status and quit.
#
# Arguments:
# host host to send the audio data to (required unless -l or -s).
# track track number where to start; alternatively,
# min sec [frames] absolute address where to start;
# default is continue at current point according to status.
import
cd
import
sys
from
socket
import
*
import
getopt
HOST
=
'voorn.cwi.nl'
# The host where readcd.py is run
PORT
=
50505
# Must match the port in readcd.py
def
main
():
...
...
@@ -31,10 +39,15 @@ def main():
prstatus
(
player
)
return
if
not
args
:
sys
.
stderr
.
write
(
'usage: '
+
sys
.
argv
[
0
]
+
' host [track]
\n
'
)
sys
.
exit
(
2
)
host
,
args
=
args
[
0
],
args
[
1
:]
sys
.
stdout
.
write
(
'waiting for socket... '
)
sys
.
stdout
.
flush
()
port
=
socket
(
AF_INET
,
SOCK_DGRAM
)
port
.
connect
(
HOST
,
PORT
)
port
.
connect
(
host
,
PORT
)
print
'socket connected'
parser
=
cd
.
createparser
()
...
...
@@ -52,7 +65,7 @@ def main():
[
min
,
sec
,
frame
]
=
args
[:
3
]
else
:
[
min
,
sec
]
=
args
frame
=
0
frame
=
'0'
min
,
sec
,
frame
=
eval
(
min
),
eval
(
sec
),
eval
(
frame
)
print
'Seek to'
,
triple
(
min
,
sec
,
frame
)
dummy
=
player
.
seek
(
min
,
sec
,
frame
)
...
...
@@ -61,7 +74,7 @@ def main():
print
'Seek to track'
,
track
dummy
=
player
.
seektrack
(
track
)
else
:
min
,
sec
,
frame
=
player
.
getstatus
()[
5
:
8
]
min
,
sec
,
frame
=
player
.
getstatus
()[
3
]
print
'Try to seek back to'
,
triple
(
min
,
sec
,
frame
)
try
:
player
.
seek
(
min
,
sec
,
frame
)
...
...
@@ -87,11 +100,8 @@ def prtrackinfo(player):
except
RuntimeError
:
break
for
i
in
range
(
len
(
info
)):
start_min
,
start_sec
,
start_frame
,
\
total_min
,
total_sec
,
total_frame
=
info
[
i
]
print
'Track'
,
zfill
(
i
+
1
),
\
triple
(
start_min
,
start_sec
,
start_frame
),
\
triple
(
total_min
,
total_sec
,
total_frame
)
start
,
total
=
info
[
i
]
print
'Track'
,
zfill
(
i
+
1
),
triple
(
start
),
triple
(
total
)
def
audiocallback
(
port
,
type
,
data
):
## sys.stdout.write('#')
...
...
@@ -117,25 +127,24 @@ def controlcallback(arg, type, data):
statedict
=
[
'ERROR'
,
'NODISK'
,
'READY'
,
'PLAYING'
,
'PAUSED'
,
'STILL'
]
def
prstatus
(
player
):
state
,
track
,
min
,
sec
,
frame
,
abs_min
,
abs_sec
,
abs_frame
,
\
total_min
,
total_sec
,
total_frame
,
first
,
last
,
scsi_audio
,
\
cur_block
,
dum1
,
dum2
,
dum3
=
player
.
getstatus
()
state
,
track
,
curtime
,
abstime
,
totaltime
,
first
,
last
,
\
scsi_audio
,
cur_block
,
dummy
=
player
.
getstatus
()
print
'Status:'
,
if
0
<=
state
<
len
(
statedict
):
print
statedict
[
state
]
else
:
print
state
print
'Track: '
,
track
print
'Time: '
,
triple
(
min
,
sec
,
fra
me
)
print
'Abs: '
,
triple
(
abs
_min
,
abs_sec
,
abs_fra
me
)
print
'Total: '
,
triple
(
total
_min
,
total_sec
,
total_fra
me
)
print
'Time: '
,
triple
(
curti
me
)
print
'Abs: '
,
triple
(
abs
ti
me
)
print
'Total: '
,
triple
(
total
ti
me
)
print
'First: '
,
first
print
'Last: '
,
last
print
'SCSI: '
,
scsi_audio
print
'Block: '
,
cur_block
print
'Future:'
,
(
dum1
,
dum2
,
dum3
)
print
'Future:'
,
dummy
def
triple
(
a
,
b
,
c
):
def
triple
(
(
a
,
b
,
c
)
):
return
zfill
(
a
)
+
':'
+
zfill
(
b
)
+
':'
+
zfill
(
c
)
def
zfill
(
n
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment