Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 968127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:25:46+00:00 2026-05-16T02:25:46+00:00

I am building a media scrobbler. What I want the program to do is

  • 0

I am building a media scrobbler. What I want the program to do is to detect the media from iTunes/MPlayer and have the program send an update via API. I got that part down, but when the same Media Title and Segment (track/episode) is compared to this If statement, it does the same action over again, which I don’t want the program to do.

Here is the problematic code that I’m going through:

    if ([[segment stringValue] length] == 0 || [[mediatitle stringValue]length] == 0 ) {
        // Do Nothing
    }
    else if ([mediatitle stringValue] == ScrobbledMediaTitle && [segment stringValue] == ScrobbledMediaSegment && scrobblesuccess == 1) {
        // Do Nothing
        }
    else {
        int httperror = [self scrobble];
        switch (httperror) {
            case 200:
                [scrobblestatus setObjectValue:@"Scrobble Successful..."];
                [GrowlApplicationBridge notifyWithTitle:@"Scrobble Successful"
                                            description:[NSString stringWithFormat:@"%@ - %@", [mediatitle stringValue], [segment stringValue]] 
                                       notificationName:@"Message"
                                               iconData:nil
                                               priority:0
                                               isSticky:NO
                                           clickContext:[NSDate date]];
                ScrobbledMediaTitle = [mediatitle stringValue];
                ScrobbledMediaSegment = [segment stringValue];
                scrobblesuccess = YES;
                //Set up Delegate
                Melative_ExampleAppDelegate* appDelegate=[NSApp delegate];
                //Set last successful scrobble to statusItem Tooltip
                [appDelegate setStatusToolTip:[NSString stringWithFormat:@"MelScrobbleX - Last Scrobble: %@ - %@", [mediatitle stringValue], [segment stringValue]]];               
                NSLog(@"ScrobbledMediaTitle = %@", ScrobbledMediaTitle);
                NSLog(@"ScrobbledMediaSegment = %@" , ScrobbledMediaSegment);
                NSLog(@"BOOL = %d", (int)scrobblesuccess);              
                break;
            case 401:
                // Set Status
                [scrobblestatus setObjectValue:@"Unable to Scrobble..."];
                [GrowlApplicationBridge notifyWithTitle:@"Scrobble Unsuccessful"
                                            description:@"Check your login information and try scrobbling again." 
                                       notificationName:@"Message"
                                               iconData:nil
                                               priority:0
                                               isSticky:NO
                                           clickContext:[NSDate date]];
                scrobblesuccess = NO;
                break;
            default:
                // Set Status
                [scrobblestatus setObjectValue:@"Unable to Scrobble..."];
                [GrowlApplicationBridge notifyWithTitle:@"Scrobble Unsuccessful"
                                            description:[NSString stringWithFormat:@"Unknown Error. Error %i", httperror]
                                       notificationName:@"Message"
                                               iconData:nil
                                               priority:0
                                               isSticky:NO
                                           clickContext:[NSDate date]];
                scrobblesuccess = NO;
                break;              
        }

}
}

I try figuring out with the NSLog output and this is what I get:

    2010-08-01 21:58:56.935 MelScrobbleX[7775:a0f] ScrobbledMediaTitle = (null)
2010-08-01 21:58:56.935 MelScrobbleX[7775:a0f] ScrobbledMediaSegment = (null)
2010-08-01 21:58:56.935 MelScrobbleX[7775:a0f] BOOL = 0
2010-08-01 21:58:56.935 MelScrobbleX[7775:a0f] mediatitle = Lia COLLECTION ALBUM "SPECTRUM RAYS"
2010-08-01 21:58:56.936 MelScrobbleX[7775:a0f] mediasegment = Tori no Uta -StripE REMIX-
2010-08-01 21:58:56.936 MelScrobbleX[7775:a0f] Scrobbled
2010-08-01 21:58:56.936 MelScrobbleX[7775:a0f] ScrobbledMediaTitle = Lia COLLECTION ALBUM "SPECTRUM RAYS"
2010-08-01 21:58:56.936 MelScrobbleX[7775:a0f] ScrobbledMediaSegment = Tori no Uta -StripE REMIX-
2010-08-01 21:58:56.936 MelScrobbleX[7775:a0f] BOOL = 1
2010-08-01 21:59:06.709 MelScrobbleX[7775:a0f] ScrobbledMediaTitle = Lia COLLECTION ALBUM "SPECTRUM RAYS"
2010-08-01 21:59:06.709 MelScrobbleX[7775:a0f] ScrobbledMediaSegment = Tori no Uta -StripE REMIX-
2010-08-01 21:59:06.710 MelScrobbleX[7775:a0f] BOOL = 1
2010-08-01 21:59:06.710 MelScrobbleX[7775:a0f] mediatitle = Lia COLLECTION ALBUM "SPECTRUM RAYS"
2010-08-01 21:59:06.710 MelScrobbleX[7775:a0f] mediasegment = Tori no Uta -StripE REMIX-
2010-08-01 21:59:06.711 MelScrobbleX[7775:a0f] Scrobbled
2010-08-01 21:59:06.711 MelScrobbleX[7775:a0f] ScrobbledMediaTitle = Lia COLLECTION ALBUM "SPECTRUM RAYS"
2010-08-01 21:59:06.711 MelScrobbleX[7775:a0f] ScrobbledMediaSegment = Tori no Uta -StripE REMIX-
2010-08-01 21:59:06.711 MelScrobbleX[7775:a0f] BOOL = 1

Can’t figure out the reason why the IF statement wouldn’t fire since the values are the same and scrobbleSuccess is true.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:25:47+00:00Added an answer on May 16, 2026 at 2:25 am

    Comparing objects with == compares pointer equality. If you want to see whether the objects have the same value (even if they exist in separate memory locations), use isEqual: or, in the case of NSString, isEqualToString:.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a 'social media widget' for work's website. I'm now adding Foursquare to
I'm building a social media app in Flash (AS3) that is tightly integrated with
Collecting the admin-media files from different django application is one of the not-so-good things
I am building a small webapp for my website and have included tinyMCE as
A very nice feature of building a percentage width site with media queries is
I'm building a website for my band and I have lots experience building websites
I'm building a list of items in jQuery mobile from an array, and paginating
I am building an IPhone application (first one) that needs to send data to
I have a window that I'm building in code, and showing: Window wndViewer =
In my app I am building my own media player. When a user selects

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.