Skip to content

Instantly share code, notes, and snippets.

@uahim
Last active May 30, 2024 21:39
Show Gist options
  • Save uahim/95dc2d0f32f725e609aaf2a97c5d31d7 to your computer and use it in GitHub Desktop.
Save uahim/95dc2d0f32f725e609aaf2a97c5d31d7 to your computer and use it in GitHub Desktop.
netzkino ;P
var preparing = new Array();
var myindex = 0;
for (var i = 0, l = allkeys; i < l; ++i) {
if (Object.values(schemaObj.props["apolloState"])[i].__typename == "CmsMovie") {
if (Object.values(schemaObj.props["apolloState"])[i].externalIdentifier) {
var slug = Object.values(schemaObj.props["apolloState"])[i].slug;
if (slug) {
var director, plusorwhat = "";
var dttitle = Object.values(schemaObj.props["apolloState"])[i].title;
var origtitle = slug.replace(/-/g, " ").replace(/(^\w{1})|(\s+\w{1})/g, letter => letter.toUpperCase());
if (origtitle == dttitle) {
var fulltitle = origtitle;
} else {
var fulltitle = origtitle + " (Dt.: " + dttitle + ")";
}
// split full title?
var id = Object.values(schemaObj.props["apolloState"])[i].id;
var runtimeInSeconds = Object.values(schemaObj.props["apolloState"])[i].runtimeInSeconds;
runtimeInSeconds = Math.floor(runtimeInSeconds / 60);
if (runtimeInSeconds == null) {
runtimeInSeconds = 3600;
}
var productionYear = Object.values(schemaObj.props["apolloState"])[i].productionYear;
if (productionYear == null) {
productionYear = "0000";
}
// var rating = Object.values(schemaObj.props["apolloState"])[i].rating;
var widescreen = schemaObj.props["apolloState"]['$CmsMovie:' + id + '.widescreenImage'].masterUrl;
var howmany = 0;
var justtestin = Object.values(schemaObj.props["apolloState"])[i].flags.json.map((word) => {
if (word.indexOf("plus-exclusive") != -1) {
howmany++;
}
});
if (howmany > 0) {
plusorwhat = "plus";
} else {
plusorwhat = "minus";
}
if (schemaObj.props["apolloState"]['$CmsMovie:' + id + '.cmsMovieContentPeopleByContentMovieId({\"condition\":{\"connectionType\":\"director\"}}).nodes.0.person']) {
director = schemaObj.props["apolloState"]['$CmsMovie:' + id + '.cmsMovieContentPeopleByContentMovieId({\"condition\":{\"connectionType\":\"director\"}}).nodes.0.person'].name;
}
if ((director == "") || (director == "undefined") || (director == "N/A")) {
director = "-";
}
preparing[myindex] = fulltitle + "|https://www.netzkino.de/filme/" + slug + "|" + widescreen + "|" + runtimeInSeconds + "|" + productionYear + "|" + director + "|" + plusorwhat;
myindex++;
//if (howmany > 0) {
// console.log(id + ": " + slug);
// if (productionYear == null) {
//console.log(productionYear);
// }
//}
}
}
}
}
copy(preparing.sort())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment