How do you get the playtime of an iTunes track with applescript? - command-line

I'm just starting to play around with Geektool and applescripting to make my mac desktop fun and I've run into a question I can't seem to find an answer to. How do you get the current song playtime from an osascript command? I've found great resources on how to do just about anything else with iTunes and osascript on the command line but no one seems to care at all about showing the current playtime. Thanks! I'm assuming it will be something like:
osascript -e 'tell application "iTunes" to time of current track'
I already tried that though and it tells me how long the song is. I want to know how long it has been playing.

iTunes Suite / application:
player position (integer) : the player’s position within the currently
playing track in seconds.
$ osascript -e 'tell app "itunes" to player position'
56
It will return missing value if no song is playing/paused (like after starting iTunes, but before playing anything).
While you are at it, you might as well ask for the track's duration, start and finish points:
$ osascript -e 'tell app "itunes" to {duration, start, finish} of current track & {player position}'
0.0, 254.772003173828, 254.772003173828, 55
The duration (fractional seconds) might be nicer to work with than the time (string in MM:SS format).

The iTunes Applescript dictionary doesn't have an elapsed time function or property for any of the classes. You'll have to roll your own.

Related

Stop Game Speed Hack

I have an app where I open a HTML5 game in WebView, its a single player game where we match 2 players and who ever scores more wins the game. This has a time limit. There are users who use speed hack X8 Speeder for one. I am trying to find how do I avoid this.
How do I detect if a particular app is installed on the phone. Even if they change the app name
How do it detect if my APK has been patched or modified.
Any help would be great.
Regards
Mitsy
Off the top of my head, I'd try to verify game sessions on the backend. When game completes, your app sends the complete log of what happened to your server which then analyzes it. If the log was generated by a script (like this, for example: https://x8speeder.com/?p=77), it will have very repeated and detectable sequences. You can then discard this score and not put it on the leaderboard.

Adb logcat crashes for many months

I'm working on a windows app to make diagnostics of android smartphone.
This app is performing adb commands to get many system informations.
For many months, I'm working on study logcat to make apps statistics and count :
Crashes by app
Number of start by app (or last starting date)
I'm using the command below
adb logcat -d -b events -v time
Thanks to this, I can extract and analyse occurences of "am_crash" lines and "am_activity_resume" to get some informations, but it seems that the output of my command is limited in the time. I'd like to get informations for many months, or if possible for all the lifetime of the smartphone connected.
Could someone help me to find a workaround ?
logcat buffers are circular and have predetermined size. You can change the size but the change won't be persistent. There is no "workaround" for the stock Android. You would need a custom logging app which would save all the events you want to a separate log.

Delayed Recording Start in bigbluebutton

We use the recording and playback feature of bigbluebutton. Is there a way to kick off the recording feature of a already created meeting after the meeting is created? Basically we start the meeting 10 minutes prior to the actual start time to give the presenter time to upload presentation, check audio etc. We would like to start the actual recording only at the actual start time to prevent the 10 minute useless stuff during playback?
Is it possible through API or some console command? We have a way to do it either way..
Any help is much appreciated
Thanks in advance
You could try enabling the autoRecord feature to start recording the session, whenever a meeting is created. You can check out the bigbluebutton property file located at- /var/lib/tomcat7/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties
Change the field autoStartRecording=true and restart bigbluebutton by sudo bbb-conf --restart
The recording button should now be automatically switched on, once you enter a meeting. Hope this helps :)
Now it's possible after BigBlueButton 0.9.0 came. There is feature in meeting interface - start/stop recording button.
Please see more in official documentation: Start/Stop Recording

Trying to play sound when an iPhone is on silent in Xcode 5

I'm trying to allow me sound to be played even if the user has got their device on silent, i have looked everywhere on how to do this and can't find the result I'm looking for! I'm using Xcode 5 and iOS 7.1 as my build. Any help would be amazing !
A quick answer is: no, there is no way to detect if the mute switch is on though public API.
It has been a "way" to do this. If a 3 second sound whose length is nearly 0 in completion block, it is assumed it is set to mute mode.
But I wouldn't rely on that and instead:
Why not just implement a way in your App to let your users know that when their phone is on mute, no sound is played? Just like they warn people that the hot coffee is hot, which may cause burns?

Start data downloading in background mode

I need to have the following things to work while my iphone application is in the background mode.
1.Run a clock.
2.Communicate with the server every 15 mins to get the server time and one another value.
3.Need to start downloading data in background mode.
I searched a lot whether these are possible or not. Kindly give confirmation on these.
I am developing an iPhone application which involves Ticket Booking System. I registered my application as location based beacuse it is using user's location taken in background for a purpose.
My problem is that i need to run an internal clock in my application in background mode. I need to write the codes for internal clock in core location delegate methods, so that internal clock will also run along with the location bsed services. Will my app get rejected? Is anything wrong in doing like this?
I need to get the correct time to use in my app, so that i am running this internal clock. I can use NSDate, but that will return the device time. Anyone can change the device time. So once somebody chaged, wrong time will affect the smooth functioning of the app. Kindly some body suggest to get the correct time with out running the internal clock ?
I suppose you want to do this with your app not running in the foreground - and that is not possible, if you don't use some tricks like playing an empty audio file and pretending to be a music player or the like.
In iOS, you can only execute code of your app while it is actively running in the foreground, except for some specific tasks like VOIP or music playing.
If you want to do this while your app is running in the foreground, just use NSTimer and a background process for loading, like it was suggested. But then you should also prevent the iPhone from entering SLEEP mode after 1 minute, otherwise it won't work when th euser is not actively using the app during the 15 minutes ...
This is possible, what you need to do is,
1] Run a background thread, in which set a NSTimer with 15mins.
2] Set repeat:YES to call it at every 15mins.
3] And start download your need there!
I will do like this if I stuck like your situation!