RePod / psdle

Improving everyone's favorite online download list, one loop at a time.
https://repod.github.io/psdle
MIT License
194 stars 14 forks source link

Can't export list, undefined variables #15

Closed jfineberg closed 9 years ago

jfineberg commented 9 years ago

Trying to use the "Export View" or "CSV" features generate a console error and do not download the list.

Chrome:

Uncaught TypeError: Cannot read property 'indexOf' of undefined        psdle.js?_=1425914289156:568 

(anonymous function)                                                jquery.min.js:4 

x.extend.each                                                        psdle.js?_=1425914289156:565

repod.psdle.exportList.formatRow                                    psdle.js?_=1425914289156:532 

(anonymous function)                                                jquery.min.js:4 

x.extend.each                                                        jquery.min.js:4 

x.fn.x.each                                                            psdle.js?_=1425914289156:532 

repod.psdle.exportList.delimited.gen                                psdle.js?_=1425914289156:540 

repod.psdle.exportList.delimited.handle                                psdle.js?_=1425914289156:519 

(anonymous function)                                                jquery.min.js:5 

x.event.dispatch                                                    jquery.min.js:5 

x.event.add.v.handle                                                jquery.min.js:5

Firefox:

TypeError: a is undefined         psdle.js:568
RePod commented 9 years ago

Please try using this version.

jfineberg commented 9 years ago

I encountered the same error on that version.

RePod commented 9 years ago

Store language?

jfineberg commented 9 years ago

en-us

RePod commented 9 years ago

I am unable to recreate this problem on Firefox 36.0.1 and Chrome 40.0.2214.115 m via exporting with all options (with Catalog and PS TV disabled and enabled in startup).

Any specific steps you're doing or abnormalities?

jfineberg commented 9 years ago

I am using the same version of Chrome, and even updated it to 41.0.2272.76 m - without any changes in result.

I don't believe my steps or usage is anything special, but I do have over 500 items in my download list. Could that cause weirdness?

RePod commented 9 years ago

I doubt the number of items is a problem. The problem might be it's trying to access something non-existent.

Try this version while monitoring the console. It should spit out every item it tries to format and subsequently fail when attempting to format the one that may be causing it.

jfineberg commented 9 years ago

Wow, thanks for that debugging version! I think I found the culprit...

http://imgur.com/a/cQI0G

"Sony Network Entertainment PS3™ Themes" shows in the default Download List, but appears broken in psdle. It wouldn't bother me at all if this didn't show up in the export. Would it be possible to implement a try/catch and ignore broken items?

RePod commented 9 years ago

I could throw it into a try catch but that wouldn't really solve the issue (aside from not completely dying). If I can find out why it's getting (or not getting) bad information I could isolate the solution to that specifically instead of the entire row formatting. If I had to think of the direct cause it's not getting a title despite being able to. If this is the case I might be parsing the Entitlements wrong (which is how the DL List does its magic).

I notice you have Catalog enabled. Do you get similar results with it disabled? Also, right-click and copy the link of the image and title on the list, separately, to get the SKU ID and product ID (which may or may not be different from each other). This will enable me to look at the Catalog responses. If this is not the case then I'll have to look into the Entitlements specifically.

Example: UP9000-PCSA00116_00-COUNTERSPYVITA00 is the SKU ID for Counterspy (PS3/4/V) but the product ID for the PS4 version is UP9000-CUSA00458_00-COUNTERSPYPS4000.

jfineberg commented 9 years ago

Same results with or without catalog.

From your JSON objects:

{
   "deep_type":"unknown",
   "pid":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
   "id":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
   "api_icon":"https://image.api.np.km.playstation.net/images/?format=png&image=http%3A%2F…DSmxEsmPuAyxvI.png&sign=045a88db0da9f88e272329887d2fc89a15de9c02&w=31&h=31",
   "size":719760,
   "platform":[
      "PS3"
   ],
   "size_f":"703KB",
   "icon":"https://image.api.np.km.playstation.net/images/?format=png&image=http%3A%2F…DSmxEsmPuAyxvI.png&sign=045a88db0da9f88e272329887d2fc89a15de9c02&w=31&h=31",
   "date":"2013-02-26T15:00:49Z",
   "pdate":"2/26/2013",
   "url":"https://store.sonyentertainmentnetwork.com/#!/en-us/cid=UT0016-NPUO00010_00-GCA13PSVITAGAME1",
   "platform_og":[
      "PS3"
   ],
   "index":395,
   "safe_icon":true
}
RePod commented 9 years ago

Please run the following in your console on the store page, PSDLE is not required:

$.each(gEntitlementManager.getAllEntitlements(), function(k,v) {
    if(v.id == "UT0016-NPUO00010_00-GCA13PSVITAGAME1") console.log(v);
});

This will loop through your Entitlements until it finds the problematic item (UT0016-NPUO00010_00-GCA13PSVITAGAME1) then log the Entitlements information associated with it.

Please post that output here.

jfineberg commented 9 years ago
{
   "active_date":"2013-02-26T15:00:49Z",
   "active_flag":false,
   "drm_def":{
      "active_flag":false,
      "autoDownload":false,
      "availableDate":"2013-02-26T15:00:49Z",
      "contentType":"GAME",
      "downloadableStatus":"ready",
      "drmContents":[
         {
            "bitrate":0,
            "contentId":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
            "contentSize":719760,
            "contentUrl":"",
            "downloadType":0,
            "drmContentType":1,
            "drmType":2,
            "gracePeriod":0,
            "platformIds":2147483648,
            "position":0,
            "spName":"Sony Network Entertainment",
            "titleName":"Sony Network Entertainment PS3™ Themes"
         }
      ],
      "duration":0,
      "entitlementId":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
      "episodeNumber":0,
      "firstPlayExpiration":0,
      "firstPlayExpirationHours":0,
      "image_url":"https://image.api.np.km.playstation.net/images/?format=png&image=http%3A%2F…PCALBwverxDSmxEsmPuAyxvI.png&sign=045a88db0da9f88e272329887d2fc89a15de9c02",
      "media_type":0,
      "productId":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
      "release_date":0,
      "runtime":0,
      "salesType":"own",
      "seasonOrder":0,
      "startedStreaming":false,
      "year_release":0
   },
   "entitlement_type":2,
   "feature_type":0,
   "id":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
   "inactive_date":"2013-02-26T15:00:49Z",
   "is_consumable":false,
   "license":{
      "entitlement_id":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
      "feature_type":0,
      "infinite_duration":true,
      "start_date":"2013-02-26T15:00:49Z"
   },
   "preorder_flag":false,
   "product_id":"UT0016-NPUO00010_00-GCA13PSVITAGAME1",
   "revision_id":1343797132781,
   "sku_id":"UT0016-NPUO00010_00-GCA13PSVITAGAME1-UH01",
   "subs_flag":false,
   "use_count":0,
   "use_limit":0
}
RePod commented 9 years ago

Problem found! This is very interesting. PSDLE looks for _object.drmdef.contentName which clearly doesn't exist here.

This seems to be special content where the title is located at _object.drmdef.drmContents.titleName instead.

Try this version which now takes this new info into consideration!

jfineberg commented 9 years ago

Unfortunately, the result was the same in that version and that problem item was still showing as "undefined."

RePod commented 9 years ago

One more.

jfineberg commented 9 years ago

That's it! It's working! You've been an incredible help. Thank you so much.

RePod commented 9 years ago

I was wrong about it being a special item using a different section to store it's name. However, this seems to be the parent's name which is better than nothing I suppose (despite being misleading since the problem item is Vita related).

Maybe I can use this for folders or something.