Having issues recently with this.. it worked up until 1hr ag

January 24, 2013 at 18:11:39
Specs: Windows 7
@echo off

set timeout=15
set dir=Downloads

set /p user=Enter user name: %user%
echo.
echo Starting...
echo.
:: ==========================================================================================================================

:: Start grabbing...
:grab
:: Get Timestamp / Set Txt filename
set stamp=%DATE:/=-%@%TIME::=-%
set txt=%TMP%\out_%user%_[%stamp: =%].txt

:: Begin rtmpdump #1
rtmpdump2 -V -v -m 3 -C S:AnonymousUser -C S:%user% -C S:2.813 -C S:pbkdf2_sha256$10000$pRCnOSTFKNa6$0U21JGWbTVL69p7Kbe68NJlvUfwKhgPKih+kMkAgir0= -r rtmpe://edge.stream.highwebmedia.com/live-edge/a -p chaturbate.com/%user% 2>%txt%

:: ==========================================================================================================================

:: Load Txt, Locate line #110, extract the PublicStatus string (e.g. offline/private *or* stream key)
for /f "delims=" %%a in ('findstr /n . %txt% ^| findstr "^112:"') do set var="%%a"
for /f "delims=" %%a in ('findstr /n . %txt% ^| findstr "^111:"') do set var2="%%a"
for /f "delims=" %%a in ('findstr /n . %txt% ^| findstr "^113:"') do set var3="%%a"
:: Delete the Txt file once we have the key
del %txt%

:: Clean up the string
set key="%var:~57%"
set key=%key:>=%
set key=%key:"=%

set status="%var2:~57%"
set status=%status:>=%
set status=%status:"=%

set addr="%var3:~57%"
set addr=%addr:>=%
set addr=%addr:"=%

:: In order to detect whether a camera is truly online or offline, and grabbable - I am relying on a digit which can either be 1 or 0
:: I assume that 1 means that the streamkey *is* present, and that 0 means there is no streamkey.
:: 0 appears for error/offline/private/group/away. While it will be 1 when online or password
::set status=%var:~57,1%

:: If a camera is offline, we goto :offline
if not %status%==okay goto offline
:: Otherwise, we go to :online
if %status%==okay goto online && set prevkey=%key%

:: ==========================================================================================================================

:: ======================= OFFLINE =====================
:: This code is executed if the camera is offline.

:offline
title %user% @ %TIME% (OFFLINE)
color F8
echo.
echo -------------------------------------
echo ERROR: Key could not be obtained for %user%.
echo Server returned: %status% (%TIME%)

goto done
:: ======================= ONLINE =====================
:: This code is executed if the camera is found to be online.

:online
title [D]%user% @ %TIME% (ONLINE!)
color 2F
echo.
echo -------------------------------------
echo SUCCESS: Downloading "%user%" [%DATE%-%TIME%]...
echo.
echo Status received: '%status%' - %addr%
echo Stream Key:
echo %key%
echo.

echo.%key%>>keys.txt
:: Get a new timestamp, now used for the FLV download filename
set stamp=%DATE:/=-%@%TIME::=-%

:: Create folder if doesn't exist.
if not exist %dir% md %dir% && echo *** Created directory "%dir%".

:: Set the filename. First 64 chars of stream key + timestamp
set fname=Downloads/%key:~0,32%_[%stamp: =%].flv

:: Begin the actual download.
rtmpdump -v -r rtmp://%addr%/live-origin/%key% -o %fname%

:done
title %user% @ %TIME% (OFFLINE)
color F8
timeout %timeout%
goto grab


pause


See More: Having issues recently with this.. it worked up until 1hr ag

Report •


#1
January 24, 2013 at 18:14:21
the %user% is not really supposed to be there in the line
set /p user=Enter user name: %user%

Report •

#2
January 25, 2013 at 10:58:38
Just looking at the basics, where does it hang up. You might be able to tell this better by setting the line
@echo off to ::@echo off
to see where it hangs, if it does. I assume that you ensured though the scrip that the camera is available.

:: mike


Report •

#3
January 25, 2013 at 12:14:55
this was already set, above, using var2~57, but you never isolated a single digit from the front of the string:
::set status=%var:~57,1%
You might need: set status=%status:~0,1%

:: If a camera is offline, we goto :offline
if not %status%==okay goto offline
:: Otherwise, we go to :online
of course, "set prevkey" never gets executed here, may not matter:
if %status%==okay goto online && set prevkey=%key%

if %status%==okay (
set prevkey=%key%
goto :online)

and I assume okay is set to "1" somewhere else in the code.


Report •

Related Solutions


Ask Question