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
6c6b6094
Kaydet (Commit)
6c6b6094
authored
Haz 03, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improved functionality, by Sjoerd
üst
05b55e76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
+32
-6
playcd.py
Demo/sgi/cd/playcd.py
+32
-6
No files found.
Demo/sgi/cd/playcd.py
Dosyayı görüntüle @
6c6b6094
# Play CD audio on speaker or headphones.
# Play CD audio on speaker or headphones.
callbacktypes
=
[
'audio'
,
'pnum'
,
'index'
,
'ptime'
,
'atime'
,
'catalog'
,
'ident'
,
'control'
]
def
playaudio
(
port
,
type
,
audio
):
def
playaudio
(
port
,
type
,
audio
):
port
.
writesamps
(
audio
)
port
.
writesamps
(
audio
)
def
prtrack
(
cdinfo
,
type
,
pnum
):
if
cdinfo
.
track
[
pnum
]
<>
''
:
print
'playing "'
+
cdinfo
.
track
[
pnum
]
+
'"'
else
:
print
callbacktypes
[
type
]
+
': '
+
`pnum`
def
callback
(
arg
,
type
,
data
):
def
callback
(
arg
,
type
,
data
):
print
`type`
,
`data`
print
callbacktypes
[
type
]
+
': '
+
`data`
def
tcallback
(
arg
,
type
,
data
):
print
callbacktypes
[
type
]
+
': '
+
triple
(
data
)
def
triple
((
a
,
b
,
c
)):
def
triple
((
a
,
b
,
c
)):
return
zfill
(
a
)
+
':'
+
zfill
(
b
)
+
':'
+
zfill
(
c
)
return
zfill
(
a
)
+
':'
+
zfill
(
b
)
+
':'
+
zfill
(
c
)
...
@@ -39,12 +50,20 @@ def prstatus(status):
...
@@ -39,12 +50,20 @@ def prstatus(status):
print
'Future:'
,
dummy
print
'Future:'
,
dummy
def
main
():
def
main
():
import
sys
,
readcd
,
al
,
string
,
AL
,
CD
import
sys
,
readcd
,
al
,
AL
,
CD
,
cdplayer
verbose
=
0
r
=
readcd
.
Readcd
()
.
init
()
r
=
readcd
.
Readcd
()
.
init
()
prstatus
(
r
.
getstatus
())
prstatus
(
r
.
getstatus
())
prtrackinfo
(
r
.
gettrackinfo
())
prtrackinfo
(
r
.
gettrackinfo
())
l
=
[]
cdinfo
=
cdplayer
.
Cdplayer
()
.
init
(
r
.
gettrackinfo
())
if
cdinfo
.
title
<>
''
:
print
'Title: "'
+
cdinfo
.
title
+
'"'
if
cdinfo
.
artist
<>
''
:
print
'Artist: '
+
cdinfo
.
artist
for
arg
in
sys
.
argv
[
1
:]:
for
arg
in
sys
.
argv
[
1
:]:
if
arg
==
'-v'
:
verbose
=
1
continue
x
=
eval
(
arg
)
x
=
eval
(
arg
)
try
:
try
:
l
=
len
(
x
)
l
=
len
(
x
)
...
@@ -64,13 +83,20 @@ def main():
...
@@ -64,13 +83,20 @@ def main():
for
i
in
range
(
8
):
for
i
in
range
(
8
):
r
.
setcallback
(
i
,
callback
,
None
)
r
.
setcallback
(
i
,
callback
,
None
)
r
.
removecallback
(
CD
.
PTIME
)
if
verbose
:
r
.
removecallback
(
CD
.
ATIME
)
r
.
setcallback
(
CD
.
PTIME
,
tcallback
,
None
)
r
.
setcallback
(
CD
.
ATIME
,
tcallback
,
None
)
else
:
r
.
removecallback
(
CD
.
PTIME
)
r
.
removecallback
(
CD
.
ATIME
)
r
.
setcallback
(
CD
.
PNUM
,
prtrack
,
cdinfo
)
r
.
setcallback
(
CD
.
AUDIO
,
playaudio
,
port
)
r
.
setcallback
(
CD
.
AUDIO
,
playaudio
,
port
)
data
=
r
.
play
()
data
=
r
.
play
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
pass
status
=
r
.
getstatus
()
print
'Interrupted at '
+
triple
(
status
[
2
])
+
' into track '
+
\
`status[1]`
+
' (absolute time '
+
triple
(
status
[
3
])
+
')'
al
.
setparams
(
AL
.
DEFAULT_DEVICE
,
oldparams
)
al
.
setparams
(
AL
.
DEFAULT_DEVICE
,
oldparams
)
main
()
main
()
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