English 中文(简体)
用 Apple果书写方式把流利的歌曲带入:
原标题:Getting song name of streaming track in iTunes with Applescript

当这个轨道是电台时,我怎么能把目前轨道的歌首带入>?

我指的是在无线电名称以下的插座:

“entergraph

如下文所示,它的名字给我: Trance Channel - DIGGITALLY IMPORTED - we can t definition it!but not the歌曲

tell application "iTunes"
    set thisTrack to current track
    set trackName to the name of thisTrack
    set trackTime to thisTrack s time
end tell

which is expected since the info in my library is: enter image description here but is there a way to specially deal this streaming tracks? and get their info correctly like iTunes does in the first picture? I know current track is a radio because its time will be missing value and not of the form MM:SS if that helps a bit.

这是可能的吗?

最佳回答

我用推波文字字眼来寻找“流”。

tell application "iTunes"
    current stream title
end tell
问题回答

看来,在第12.2号投稿中,各种有趣的事情正在进行之中。

  1. current stream title returns missing value when requesting the name of a stream coming from "For You" (e.g. something not in your current music library). name of the current track doesn t exist. For example, I m listening to "Alternative Gems: 1994" from "For You" right now (Yay- grad school days) and I can t get any information about what is playing. If I go to the album the track is playing from to play something else, missing value and error -1728 on name of current track too.

  2. 在聆听上文“@ivan”的1台无线电台时,我还收到<条码><>分机值<>>><>>><>>><>>><><>>> >现行<名称>。 我获得“第1号”。 如@dougscripts分所示,stream entitled在地图上各行各业。

  3. 加入通过“为你”创建的radio站似乎给我正确的目前的名称。

因此,简言之,混乱。

并非所有流出者都会对流数据进行格式,因此,从目前流出的所有权中得出的结果可能不一致。

我最后找到了一种办法,利用SDK,将数据直接从主人手中删除。

这种方法将核对<代码>现成代码>。 如同正常情况一样,当发现<条码>条码<>条码>缺失时(在轨迹流出时有一个共同谅解),我们就开始利用无障碍提供的价值观,从LCD中获取价值。

#!/usr/bin/env osascript -l JavaScript
/* globals Application */
function main () {
  var itunes = new Application( iTunes )
  var currentTrack = itunes.currentTrack
  var output = {
    name: currentTrack.name(),
    artist: currentTrack.artist(),
    position: itunes.playerPosition()
  }
  if (currentTrack.artist() ===   ) {
    var app = new Application( System Events )
    var itunesProcess = app.applicationProcesses.byName( iTunes )
    // Get the text values from the first scrollable area which is the LCD Display
    var arr = itunesProcess.windows[0].scrollAreas[0].staticTexts

    output.name = arr[0].name()
    // Clean up the artist name, as it may contain the Show Name. 
    output.artist = arr[2].name().replace(  —   + currentTrack.name(),   )
  }
  return JSON.stringify(output, null, 2)
}
main()

例产出:

{
    "name": "Wild Smooth (Gundam Radar Rip)",
    "position": "34:06",
    "artist": "MUBLA"
}

参看chmod +x

注:它要求在

另一种选择——鉴于产出的不一致——可能在;VLC;并询问,相反的是, Apple本支持相对有限,但至少是https://github.com/videolan/vlc/blob/1c2f90725a016ee 19523f63c23fb68e5791cerellowe/modules/gui/macos/osx/os-intiona/scripthno 。 来源代码可供查阅,以便了解你可以询问的情况。

osascript -e  tell application "VLC" to get name of current item 

After weeks of tearing my hair out trying to figure this out myself. I have managed to find a very hacky solution to this exact issue.

your not to such as, berez/em>。

为了让目前的游戏轨迹,即使从Beatas电台播音,你也不得不考虑奥委会的做法(用屏幕,将图像转换成文字)

下面的《鲁比法典》将获得这一解决办法。

它将检查目前的轨道,如果是<条码>。 田间为空白,(如一条轨道流出)则属于欧安会的方法。

require  json 
require  rtesseract 
class CurrentTrack
  def self.check
    js_command = %Q{var itunes = Application("iTunes");
    var currentTrack = itunes.currentTrack;
    JSON.stringify({
      window_bounds: itunes.windows[0].bounds(),
      name: currentTrack.name(),
      artist: currentTrack.artist(),
      position: itunes.playerPosition()
    })
    }
    command = "osascript -l JavaScript -e  #{js_command} "
    result =  `#{command}`
    json = JSON.parse(result, symbolize_names: true)
    json[:position] = json[:position].to_i
    json[:cue] = Time.at(json[:position]).utc.strftime( %H:%M:%S )
    if json[:artist] ==   
      sc_command = %Q{screencapture -R #{json[:window_bounds][:x]},#{json[:window_bounds][:y].to_i + 30},#{json[:window_bounds][:width]},#{json[:window_bounds][:height]} capture.png}
      `#{sc_command}`
      image = RTesseract.new("capture.png", processor:  none )
      ocr = image.to_s.split("
") # Getting the value
      unless ocr.first ==  Soulection 
        json[:name] = ocr.first
        json[:artist] = ocr[1].split(  —  ).first
      end
    end
    json.delete :window_bounds

    json
  end
end

You ll need to install rtesseract to get this working.

洞穴,这本文字要求,在你的台上可以看到落户小窗户。





相关问题
2 mysql instances in MAC

i recently switched to mac. first and foremost i installed xampp. then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL. now the seperate mysql installation is ...

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Controlling OSX windows

I m trying to control windows of a foreign OSX applications from my application. I d like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window ...

Switching J2SE versions on Mac OS (SnowLeopard)

My current JDK on Mac OS (10.6) is set to 1.6 and I d like to switch to 1.5. A listing of /System/Library/Frameworks/JavaVM.framework/Versions/ shows: lrwxr-xr-x 1 root wheel 10 Nov 3 18:34 ...

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

export to MP3 from quicktime API

A question for Apple,QT programmers. Would like to know if it s possible to export a Movie object to MP3 using the QuickTime API. Preferably the ConvertMovieToFile function. I ve looked at ...

热门标签