Giter VIP home page Giter VIP logo

Comments (4)

sleemanj avatar sleemanj commented on August 16, 2024

What is the exact error you are getting?

On 2014-12-05 00:59, iolbr wrote:

Hi,
using your script on MacOS I get an compile error located in line 190:
// Else normal file
$Day = ($r[4] & 0b0000000000011111);
$Month = ($r[4] & 0b0000000111100000) >> 5;
$Year = (($r[4] & 0b1111111000000000) >> 9)+1980;

$Seconds = ($r[5] & 0b0000000000011111) * 2;
$Minutes = ($r[5] & 0b0000011111100000) >> 5;
$Hours = ($r[5] & 0b1111100000000000) >> 11;

Seems that something is different on Mac dealing with the date arithmetic. Any idea what I've to change?

I've to admit that I've no experience with php - so it might be quite obvious…

Best regards,
Ingo

Reply to this email directly or view it on GitHub [1].

Links:

[1] #2

from flashairsync.

iolbr avatar iolbr commented on August 16, 2024

Parse error: parse error in sync_with_flashair.php at line 189 (I've marked my line 189 with ***) :

#!/usr/bin/php

$From)); unlink(dirname($To) . '/.Manifest/'.basename($To)); } elseif(!file_exists($To)) { if(copy("http://{$FlashAirIP}".$From, $To)) { echo "Copy {$From}\n"; touch($To, $Time); // Add it to the manifest touch(dirname($To) . '/.Manifest/'.basename($To), $Time); } else { if(!alive()) { force_next_update(); exit; } } } } // Check to see if the card is on the network function alive() { global $FlashAirIP; $RC = 1; system("ping -c 1 $FlashAirIP >/dev/null 2>/dev/null", $RC); return !$RC; } // Write a flag to fo a forced update the next time // this happens if we are interrupted by the camera going // into power down during a sync function force_next_update() { global $SyncTo; touch($SyncTo . '/.Force_Update'); echo "Interrupted during processing.\n"; } function command($Op, $Args = array()) { global $FlashAirIP; if(!alive()) { force_next_update(); exit; } ``` $Command = is_numeric($Op) ? "http://{$FlashAirIP}/command.cgi?op=$Op" : "http://{$FlashAirIP}/{$Op}?__DUMMY__=1"; foreach($Args as $k => $v) { $Command .= "&$k=".rawurlencode($v); } $Contents = file_get_contents($Command); if($Contents === FALSE) { force_next_update(); exit; } return $Contents; ``` } if(!alive()) { echo "Not Online\n"; exit; } if(!$ForceUpdate && command(102) == 0) { echo "No Changes\n"; exit; } function sync_dir($Dir, $To) { global $FlashAirIP, $TZ; $List = command(100, array('DIR' => $Dir)); ``` $List = preg_split('/\r?\n/', $List); foreach($List as $r) { $r = str_getcsv($r); if(count($r) < 3) continue; if($r[3] & 16) // bit 5 = Directory { if(!file_exists($To . '/'.$r[1])) mkdir($To . '/' . $r[1]); sync_dir($Dir . '/' . $r[1], $To . '/' . $r[1]); continue; } ``` **\* // Else normal file $Day = ($r[4] & 0b0000000000011111); $Month = ($r[4] & 0b0000000111100000) >> 5; $Year = (($r[4] & 0b1111111000000000) >> 9)+1980; ``` $Seconds = ($r[5] & 0b0000000000011111) * 2; $Minutes = ($r[5] & 0b0000011111100000) >> 5; $Hours = ($r[5] & 0b1111100000000000) >> 11; // echo "{$r[1]} {$Year}-{$Month}-{$Day} {$Hours}:{$Minutes}:{$Seconds}\n"; // $Time = mktime($Hours, $Minutes, $Seconds, $Month, $Day, $Year); $Time = strtotime("{$Year}-{$Month}-{$Day} {$Hours}:{$Minutes}:{$Seconds} {$TZ}"); sync_for_file($Dir . '/' . $r[1], $To . '/' . $r[1], $Time); } ``` } sync_dir($SyncFrom, $SyncTo); touch($SyncTo . '/.Last_Update'); ?>

from flashairsync.

sleemanj avatar sleemanj commented on August 16, 2024

I don't see any error on that line. I would suggest

Download the file fresh

Ensure your editor is keeping correct (LF) line endings

Ensure you are using a recent version of PHP

On 2014-12-05 03:41, iolbr wrote:

Parse error: parse error in sync_with_flashair.php at line 189 (I've marked my line 189 with ***) :

[...]

if(!file_exists($To . '/'.$r[1])) mkdir($To . '/' . $r[1]);
sync_dir($Dir . '/' . $r[1], $To . '/' . $r[1]);
continue;
}

*** // Else normal file
$Day = ($r[4] & 0b0000000000011111);
$Month = ($r[4] & 0b0000000111100000) >> 5;

from flashairsync.

iolbr avatar iolbr commented on August 16, 2024

Hi,
that worked! Many thanks for your support! I did a bit research and found a document stating that the number format used to create the Timestamp is supported from php 5.4 onwards. And it turned out that my mac was using 5.3!

And many thanks for publishing this charming and useful script, it is exactly the solution for my purpose of offloading my camera!

Best regards,
Ingo

from flashairsync.

Related Issues (4)

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.