Editorial Workflows


public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Insert now playing info into current cursor position or replace selection.

Shared by: moyashi

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import objc_util

action_in = workflow.get_input()

NSBundle = objc_util.ObjCClass("NSBundle")
MPMusicPlayerController = objc_util.ObjCClass("MPMusicPlayerController")
player = MPMusicPlayerController.iPodMusicPlayer()
now_playing = player.nowPlayingItem()
if now_playing:
	artist = now_playing.valueForProperty_("artist").UTF8String()
	title = now_playing.valueForProperty_("title").UTF8String()
	album = now_playing.valueForProperty_("albumTitle").UTF8String()
	if album:		
		action_out = "NowPlaying: {} by {} from {}".format(title, artist, album)
		action_out = "NowPlaying: {} by {}".format(title, artist)		
	action_out = action_in

Replace Selected Text ?
Replacement Text