Skip to content

Instantly share code, notes, and snippets.

@alexstone
Created February 27, 2014 09:51
Show Gist options
  • Select an option

  • Save alexstone/9247230 to your computer and use it in GitHub Desktop.

Select an option

Save alexstone/9247230 to your computer and use it in GitHub Desktop.

Revisions

  1. Alex Stone created this gist Feb 27, 2014.
    44 changes: 44 additions & 0 deletions comixology_parse.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    <?php
    system('clear');
    // $string = "Iron Man Vol. 5 #23.NOW";
    // $string = "Ms. Marvel (2014-) (Vol. 13) #2.NOW";
    // $string = "Uncanny X-Men Vol. 3 #19.NOW";
    $string = "Winter Soldier: The Bitter March #2 (of 5)";

    echo $string . "\n";

    // Parse out the ttle for the key
    list($key, $junk) = explode('#', $string);
    echo "Key: " . $key . "\n";

    // Parse out the issue number
    $issue_no = preg_match('/\#(\\d+)/', $string, $issue_no_data);
    if($issue_no)
    echo "\nIssue No: " . $issue_no_data[1];
    else
    echo "\nNo issue number";

    // Parse out the volume number
    $volume_no = preg_match('/Vol.\ (\\d+)/', $string, $volume_no_data);
    if($volume_no)
    echo "\nVolume No: " . $volume_no_data[1];
    else
    echo "\nNo volume found";


    echo "\n\n";

    // http://feeds.feedburner.com/ComixologyDigitalComics

    // Parse out and break off the issue number
    // Try to find the volume with a generated title-volume key (comixology_key)
    // If we can't find the volume
    // Parse the title
    // Parse the volume number (assuming 1)
    // Find the title
    // If no title found, create one
    // Find the title->volume
    // If no title->volume found, create one
    // Check for an existing issue
    // If no issue, create a new one
    // If issue found, update with Comixology data (description, release date, price [if missing], comixology_url)