Code Monkey home page Code Monkey logo

sonos-objc's People

Contributors

endoze avatar n1mda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sonos-objc's Issues

Feature request:Remove AFNetworking dependecy

Since AFNetworking is used to execute a simple HTTP GET, I suggest to remove any dependencies of AFNetworking and replacing it with NSURLConnection:

(SonosController.m)

- (void)upnp:(NSString *)url soap_service:(NSString *)soap_service soap_action:(NSString *)soap_action soap_arguments:(NSString *)soap_arguments completion:(void (^)(NSDictionary *, NSError *))block {

like

// Set Body
    [request setHTTPBody:[post_xml dataUsingEncoding:NSUTF8StringEncoding]];

    [self getRequest:request completionBlock:^(NSData *responseObject, NSError *error) {
        if(responseObject) {
            NSDictionary *response = [XMLReader dictionaryForXMLData:responseObject error:nil];
            block(response, nil);
        } else {
            if(block) block(nil, error);
        }
    }];   

where

- (void)getRequest:(NSURLRequest *)request completionBlock:(void (^)(NSData *data, NSError *error))completionBlock
{
    [NSURLConnection sendAsynchronousRequest:request
                                       queue:[NSOperationQueue mainQueue]
                           completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
                               completionBlock(data,error);
                           }];
}

Sonos time crash

I got crash on
int minutes = [[times objectAtIndex:1] intValue] * 60;

Fatal Exception: NSRangeException
*** -[__NSSingleObjectArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]

Crash in SonosController.m

Hello,

I am facing a crash on line 401 of SonosController.m. I am not doing anything special to get this crash. I guess it comes directly from the sharedInstance that initializes the devices.

So it crashes on:
NSDictionary *returnData = @{@"CurrentTransportState" : response[@"s:Envelope"][@"s:Body"][@"u:GetTransportInfoResponse"][@"CurrentTransportState"][@"text"]};

It crashes because 'response' is nil.

Martin

Issue: Sonos Play:1 Not found

I have a Sonos Play:1 on the same WiFi network.
I registered the observer and waited for changes, but nothing happened:

Code snippet:

-(IBAction)discover:(id)sender {
    [[SonosManager sharedInstance] addObserver:self forKeyPath:@"allDevices" options:NSKeyValueObservingOptionNew context:NULL];
}

pragma Sonos Delegates

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    SonosController *controller = [[SonosManager sharedInstance] currentDevice];
    [controller trackInfo:^(NSString *artist, NSString *title, NSString *album, NSURL *albumArt, NSInteger time, NSInteger duration, NSInteger queueIndex, NSString *trackURI, NSString *protocol, NSError *error){

        NSLog(@"Artist: %@", artist);
        NSLog(@"Title: %@", title);
        NSLog(@"Album: %@", album);
        NSLog(@"Album Art: %@", albumArt);
        NSLog(@"Time: %d", (int)time);
        NSLog(@"Duration: %d", (int)duration);
        NSLog(@"Place in queue: %d", (int)queueIndex);
        NSLog(@"Track URI: %@", trackURI);
        NSLog(@"Protocol: %@", protocol);

    }];
}

I can see the Sonos PLAY:1 from the Sonos app and from DLNA compatible devices.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.