Last change
on this file since 35 was 34, checked in by Nicholas Riley, 22 years ago |
Changes for Pester 1.1d1.
|
File size:
1.7 KB
|
Rev | Line | |
---|
[34] | 1 | //
|
---|
| 2 | // PSMovieAlert.m
|
---|
| 3 | // Pester
|
---|
| 4 | //
|
---|
| 5 | // Created by Nicholas Riley on Sat Oct 26 2002.
|
---|
| 6 | // Copyright (c) 2002 Nicholas Riley. All rights reserved.
|
---|
| 7 | //
|
---|
| 8 |
|
---|
| 9 | #import <QuickTime/Movies.h>
|
---|
| 10 | #import "PSMovieAlert.h"
|
---|
| 11 | #import "PSMovieAlertController.h"
|
---|
| 12 | #import "NSMovie-NJRExtensions.h"
|
---|
| 13 |
|
---|
| 14 | @implementation PSMovieAlert
|
---|
| 15 |
|
---|
| 16 | + (PSMovieAlert *)alertWithMovieFileAlias:(BDAlias *)anAlias repetitions:(unsigned short)numReps;
|
---|
| 17 | {
|
---|
| 18 | return [[[self alloc] initWithAlias: anAlias repetitions: numReps] autorelease];
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | - (id)initWithAlias:(BDAlias *)anAlias repetitions:(unsigned int) numReps;
|
---|
| 22 | {
|
---|
| 23 | if ( (self = [super init]) != nil) {
|
---|
| 24 | alias = [anAlias retain];
|
---|
| 25 | repetitions = numReps;
|
---|
| 26 | movie = [[NSMovie alloc] initWithURL: [NSURL fileURLWithPath: [anAlias fullPath]] byReference: YES];
|
---|
| 27 | if (movie == nil) {
|
---|
| 28 | [self release];
|
---|
| 29 | self = nil;
|
---|
| 30 | } else {
|
---|
| 31 | hasAudio = [movie hasAudio];
|
---|
| 32 | hasVideo = [movie hasVideo];
|
---|
| 33 |
|
---|
| 34 | if (!hasAudio && !hasVideo) {
|
---|
| 35 | [self release]; self = nil;
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | return self;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | - (BOOL)hasVideo;
|
---|
| 44 | {
|
---|
| 45 | return hasVideo;
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | - (NSMovie *)movie;
|
---|
| 49 | {
|
---|
| 50 | return movie;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | - (unsigned short)repetitions;
|
---|
| 54 | {
|
---|
| 55 | return repetitions;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | - (void)dealloc;
|
---|
| 59 | {
|
---|
| 60 | [alias release];
|
---|
| 61 | [movie release];
|
---|
| 62 | [super dealloc];
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | - (NSString *)description;
|
---|
| 66 | {
|
---|
| 67 | return [NSString stringWithFormat: @"PSMovieAlert (%@%@): %@, repeats %hu times", hasAudio ? @"A" : @"", hasVideo ? @"V" : @"", [alias fullPath], repetitions];
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | - (void)triggerForAlarm:(PSAlarm *)alarm;
|
---|
| 71 | {
|
---|
| 72 | NSLog(@"%@", self);
|
---|
| 73 | [PSMovieAlertController controllerWithAlarm: alarm movieAlert: self];
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | @end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.