Add more automation commands and properties
Added commands to control playback: play, pause, stop, previous, next. Also added a spam property to PlaylistEntry, to return the formatted spam string for the playlist entry, which is currently limited to the playing item. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
9614ec6e98
commit
b63a076e21
|
@ -125,7 +125,7 @@ void *kAppControllerContext = &kAppControllerContext;
|
|||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key {
|
||||
return [key isEqualToString:@"currentEntry"] || [key isEqualToString:@"play"];
|
||||
return [key isEqualToString:@"currentEntry"];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// ScriptAdditions.h
|
||||
// Cog
|
||||
//
|
||||
// Created by Christopher Snowhill on 2/21/22.
|
||||
//
|
||||
|
||||
#ifndef ScriptAdditions_h
|
||||
#define ScriptAdditions_h
|
||||
|
||||
@interface NSApplication (APLApplicationExtensions)
|
||||
- (id)playbackStart:(NSScriptCommand *)command;
|
||||
- (id)playbackPause:(NSScriptCommand *)command;
|
||||
- (id)playbackStop:(NSScriptCommand *)command;
|
||||
- (id)playbackPrevious:(NSScriptCommand *)command;
|
||||
- (id)playbackNext:(NSScriptCommand *)command;
|
||||
@end
|
||||
|
||||
#endif /* ScriptAdditions_h */
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// ScriptAdditions.m
|
||||
// Cog
|
||||
//
|
||||
// Created by Christopher Snowhill on 2/21/22.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "AppController.h"
|
||||
|
||||
@implementation NSApplication (APLApplicationExtensions)
|
||||
- (id)playbackStart:(NSScriptCommand *)command {
|
||||
[(AppController *)[NSApp delegate] clickPlay];
|
||||
return [NSNumber numberWithBool:YES];
|
||||
}
|
||||
- (id)playbackPause:(NSScriptCommand *)command {
|
||||
[(AppController *)[NSApp delegate] clickPause];
|
||||
return [NSNumber numberWithBool:YES];
|
||||
}
|
||||
- (id)playbackStop:(NSScriptCommand *)command {
|
||||
[(AppController *)[NSApp delegate] clickStop];
|
||||
return [NSNumber numberWithBool:YES];
|
||||
}
|
||||
- (id)playbackPrevious:(NSScriptCommand *)command {
|
||||
[(AppController *)[NSApp delegate] clickPrev];
|
||||
return [NSNumber numberWithBool:YES];
|
||||
}
|
||||
- (id)playbackNext:(NSScriptCommand *)command {
|
||||
[(AppController *)[NSApp delegate] clickNext];
|
||||
return [NSNumber numberWithBool:YES];
|
||||
}
|
||||
@end
|
23
Cog.sdef
23
Cog.sdef
|
@ -61,6 +61,21 @@
|
|||
<responds-to command="quit">
|
||||
<cocoa method="handleQuitScriptCommand:"/>
|
||||
</responds-to>
|
||||
<responds-to command="play">
|
||||
<cocoa method="playbackStart:" insert-at-beginning="yes"/>
|
||||
</responds-to>
|
||||
<responds-to command="pause">
|
||||
<cocoa method="playbackPause:" insert-at-beginning="yes"/>
|
||||
</responds-to>
|
||||
<responds-to command="stop">
|
||||
<cocoa method="playbackStop:" insert-at-beginning="yes"/>
|
||||
</responds-to>
|
||||
<responds-to command="previous">
|
||||
<cocoa method="playbackPrevious:" insert-at-beginning="yes"/>
|
||||
</responds-to>
|
||||
<responds-to command="next">
|
||||
<cocoa method="playbackNext:" insert-at-beginning="yes"/>
|
||||
</responds-to>
|
||||
</class>
|
||||
<class name="window" code="cwin" description="A window.">
|
||||
<cocoa class="NSWindow"/>
|
||||
|
@ -153,6 +168,9 @@
|
|||
<property name="bitrate" code="pBit" description="The bitrate of the entry, in kilobits per second." type="integer" access="r">
|
||||
<cocoa key="bitrate" insert-at-beginning="yes"/>
|
||||
</property>
|
||||
<property name="spam" code="pSpm" description="Formatted now playing spam for the entry." type="text" access="r">
|
||||
<cocoa key="spam"/>
|
||||
</property>
|
||||
</class>
|
||||
<!-- The old Standard Suite: run, reopen, open, print, and quit. -->
|
||||
<command name="open" code="aevtodoc" description="Open an object."/>
|
||||
|
@ -236,5 +254,10 @@
|
|||
<cocoa key="ToLocation"/>
|
||||
</parameter>
|
||||
</command>
|
||||
<command name="play" code="coreplay" description="Begin playback."/>
|
||||
<command name="pause" code="corepaus" description="Pause playback."/>
|
||||
<command name="stop" code="corestop" description="Stop playback."/>
|
||||
<command name="previous" code="coreprev" description="Play previous track."/>
|
||||
<command name="next" code="corenext" description="Play next track."/>
|
||||
</suite>
|
||||
</dictionary>
|
|
@ -101,6 +101,7 @@
|
|||
832923AF279FAC400048201E /* Cog.q1.json in Resources */ = {isa = PBXBuildFile; fileRef = 832923AE279FAC400048201E /* Cog.q1.json */; };
|
||||
83293070277886250010C07E /* OpenMPTOld.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8329306D277885790010C07E /* OpenMPTOld.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
832C1253180BD1E2005507C1 /* Cog.help in Resources */ = {isa = PBXBuildFile; fileRef = 832C1252180BD1E2005507C1 /* Cog.help */; };
|
||||
833D0C2527C4ABB80060E16A /* ScriptAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 833D0C2427C4ABB80060E16A /* ScriptAdditions.m */; };
|
||||
83489C6B2782F78700BDCEA2 /* libvgmPlayer.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83489C542782F2DF00BDCEA2 /* libvgmPlayer.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
8349270C27B4EFFC0009AB2B /* duplicateItemsTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 8349270127B4EFFC0009AB2B /* duplicateItemsTemplate.pdf */; };
|
||||
8349270D27B4EFFC0009AB2B /* deadItemsTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 8349270B27B4EFFC0009AB2B /* deadItemsTemplate.pdf */; };
|
||||
|
@ -890,6 +891,8 @@
|
|||
832923AE279FAC400048201E /* Cog.q1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Cog.q1.json; sourceTree = "<group>"; };
|
||||
83293065277885790010C07E /* OpenMPTOld.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OpenMPTOld.xcodeproj; path = Plugins/OpenMPT.old/OpenMPTOld.xcodeproj; sourceTree = "<group>"; };
|
||||
832C1252180BD1E2005507C1 /* Cog.help */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Cog.help; sourceTree = "<group>"; };
|
||||
833D0C2027C4ABA00060E16A /* ScriptAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScriptAdditions.h; sourceTree = "<group>"; };
|
||||
833D0C2427C4ABB80060E16A /* ScriptAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScriptAdditions.m; sourceTree = "<group>"; };
|
||||
833F681E1CDBCAA700AFB9F0 /* es */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
833F681F1CDBCAA800AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
833F68251CDBCAA800AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = es; path = es.lproj/Credits.html; sourceTree = "<group>"; };
|
||||
|
@ -1155,6 +1158,8 @@
|
|||
171EFE8B0F59FEAE000ADC42 /* DockIconController.m */,
|
||||
17F6C8050F603701000D9DA9 /* PlaybackEventController.h */,
|
||||
17F6C8060F603701000D9DA9 /* PlaybackEventController.m */,
|
||||
833D0C2027C4ABA00060E16A /* ScriptAdditions.h */,
|
||||
833D0C2427C4ABB80060E16A /* ScriptAdditions.m */,
|
||||
);
|
||||
path = Application;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2523,6 +2528,7 @@
|
|||
07D971E60ED1DAA800E7602E /* TagEditorController.m in Sources */,
|
||||
17E0D5EA0F520F02005B6FED /* MainWindow.m in Sources */,
|
||||
836D28A818086386005B7299 /* MiniModeMenuTitleTransformer.m in Sources */,
|
||||
833D0C2527C4ABB80060E16A /* ScriptAdditions.m in Sources */,
|
||||
17E0D5EB0F520F02005B6FED /* MiniWindow.m in Sources */,
|
||||
17E0D5EC0F520F02005B6FED /* PositionSlider.m in Sources */,
|
||||
17E0D5ED0F520F02005B6FED /* TimeField.m in Sources */,
|
||||
|
|
Loading…
Reference in New Issue