- Registriert
- 10.07.08
- Beiträge
- 43
Hi,
und zwar suche ich ein "Now Playing" Script für den VLC Player ähnlich wie das was es für Adium/Linkinus bereits als iTunes Version gibt, also dass Der Titel und die Aktuelle Position Ausgegeben wird...
BSP: Ich schaue Königin der Verdammten 00:10:32/01:30:23
oder so ähnlich...
würde mich freuen wenn mir jemand helfen kann.
EDIT: hab was gefunden, das funktioniert aber leider nicht, bekomme immer die Ausgabe "Ich schaue gerade nichts" egal ob ein Video läuft oder nicht.
und zwar suche ich ein "Now Playing" Script für den VLC Player ähnlich wie das was es für Adium/Linkinus bereits als iTunes Version gibt, also dass Der Titel und die Aktuelle Position Ausgegeben wird...
BSP: Ich schaue Königin der Verdammten 00:10:32/01:30:23
oder so ähnlich...
würde mich freuen wenn mir jemand helfen kann.
EDIT: hab was gefunden, das funktioniert aber leider nicht, bekomme immer die Ausgabe "Ich schaue gerade nichts" egal ob ein Video läuft oder nicht.
Code:
linkinuscmd()
on linkinuscmd()
-- Obtain the player state and video title.
set theState to getTheState()
set theTitle to str_replace("_", " ", getTheTitle())
-- Check if the VLC state was determined to be "playing".
if theState is "playing" then
if theTitle is not "" then
-- Return what is most likely the title.
return "Ich schaue gerade: " & theTitle
end if
end if
-- None of the above is true... :(
return "Ich schaue gerade nichts"
end linkinuscmd
on getTheState()
-- Initialise the return value.
set theState to ""
-- Try and obtain the current state.
try
tell application "System Events"
tell process "VLC"
tell menu 1 of menu bar item "Playback" of menu bar 1
get title of menu item 1
set play_pause_btn to the result
get enabled of menu item 2
set stop_enabled to result
end tell
end tell
end tell
-- We're only interested if VLC is playing.
if stop_enabled is true and play_pause_btn is "pause" then
set theState to "playing"
end if
end try
-- Return the state.
return theState
end getTheState
on getTheTitle()
-- Initialise the return value.
set theTitle to ""
-- Try and obtain the title of the playing window.
try
tell application "VLC"
set theTitle to name of first window whose id is not -1 and name is not "VLC media player" and zoomable is true
end tell
display dialog Le_titre
end try
-- Return the title.
return theTitle
end getTheTitle
on str_replace(find, replace, subject)
set prevTIDs to text item delimiters of AppleScript
set returnList to true
if class of find is not list and class of replace is list then return subject
if class of find is not list then set find to {find}
if class of subject is not list then set {subject, returnList} to {{subject}, false}
set findCount to count find
set usingReplaceList to class of replace is list
try
repeat with i from 1 to (count subject)
set thisSubject to item i of subject
repeat with n from 1 to findCount
set text item delimiters of AppleScript to item n of find
set thisSubject to text items of thisSubject
if usingReplaceList then
try
item n of replace
on error
"" -- `replace` ran out of items
end try
else
replace
end if
set text item delimiters of AppleScript to result
set thisSubject to "" & thisSubject
end repeat
set item i of subject to thisSubject
end repeat
end try
set text item delimiters of AppleScript to prevTIDs
if not returnList then return beginning of subject
return subject
end str_replace