Rapidshare curl script
A RapidShare downloading script for Linux/Unix (requires Bash and Curl). Downloads all rapidshare files from a given web page.
I found this script a while ago, and it does what it's advertised to do, only that it's not really good. It doesn't resume and it also works only with rapidshare links coded as links (most sites have them as code). Anyways, here's the code. If anyone's able to make it prettier (ie, make it resume and overall improve it), we'll all be thankful.
Note: For Rapidshare Premium users only; requires bash and curl.
#!/bin/bash
quit() {
E=$1
shift
echo "$@"
exit $E
USER="USERNAME"
PASS="PASSWORD"
COOKIES=`mktemp`
LIST=`mktemp`
TMPFILE=`mktemp`
URL="$1"
[[ -z $USER || -z $PASS ]] && quit 1 "USER/PASS not set"
[[ -z $URL ]] && quit 1 "Usage: \$ $0 link"
if [[ $URL == http* ]]
then
echo "Downloading file list"
curl "$URL" > $TMPFILE
elif [[ -f $URL ]]
then
echo "Using list from file"
cat "$URL" > $TMPFILE
else
quit 3 "$URL does not appear to be an URL or existing disk file"
fi
if grep -q '<[aA]' $TMPFILE
then
cat $TMPFILE | sed -e 's/[hH][rR][eE][fF]="*\(http[^">< ]*\)/\n\1\n/g;' | grep -i '^http.*rapidshare' > $LIST
else
echo "$URL appears not to be HTML. Using as plain list."
cat "$TMPFILE" > $LIST
fi
echo "The following URLs were found:"
cat $LIST
echo "End of list"
if tty > /dev/null
then
echo "If this doesn't look right, hit CTRL-C to abort. Otherwise, Enter."
read
fi
echo "Attempting to log in"
#Login
curl -s --insecure -c $COOKIES -b $COOKIES -d login=$USER -d password=$PASS 'https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi' > $TMPFILE
if grep -q 'If you have forgotten your login' $TMPFILE
then
quit 2 "Eek, the login appeared to be invalid. See $TMPFILE"
fi
TOTAL=$(wc -l < $LIST)
while read URL
do
echo "Downloading $TOTAL files, currently ${URL##*/}"
curl -L -c $COOKIES -b $COOKIES -O "$URL"
(( TOTAL-- ))
done < $LIST
echo "All files downloaded. Attempting to log out."
#Logout
curl -b $COOKIES -c $COOKIES 'http://rapidshare.com/cgi-bin/premium.cgi?logout=1' > $TMPFILE
rm $COOKIES
rm $LIST
rm $TMPFILE
A RapidShare downloading script for Linux/Unix (requires Bash and Curl). Downloads all rapidshare files from a given web page.
I found this script a while ago, and it does what it's advertised to do, only that it's not really good. It doesn't resume and it also works only with rapidshare links coded as links (most sites have them as code). Anyways, here's the code. If anyone's able to make it prettier (ie, make it resume and overall improve it), we'll all be thankful.
Note: For Rapidshare Premium users only; requires bash and curl.
#!/bin/bash
quit() {
E=$1
shift
echo "$@"
exit $E
USER="USERNAME"
PASS="PASSWORD"
COOKIES=`mktemp`
LIST=`mktemp`
TMPFILE=`mktemp`
URL="$1"
[[ -z $USER || -z $PASS ]] && quit 1 "USER/PASS not set"
[[ -z $URL ]] && quit 1 "Usage: \$ $0 link"
if [[ $URL == http* ]]
then
echo "Downloading file list"
curl "$URL" > $TMPFILE
elif [[ -f $URL ]]
then
echo "Using list from file"
cat "$URL" > $TMPFILE
else
quit 3 "$URL does not appear to be an URL or existing disk file"
fi
if grep -q '<[aA]' $TMPFILE
then
cat $TMPFILE | sed -e 's/[hH][rR][eE][fF]="*\(http[^">< ]*\)/\n\1\n/g;' | grep -i '^http.*rapidshare' > $LIST
else
echo "$URL appears not to be HTML. Using as plain list."
cat "$TMPFILE" > $LIST
fi
echo "The following URLs were found:"
cat $LIST
echo "End of list"
if tty > /dev/null
then
echo "If this doesn't look right, hit CTRL-C to abort. Otherwise, Enter."
read
fi
echo "Attempting to log in"
#Login
curl -s --insecure -c $COOKIES -b $COOKIES -d login=$USER -d password=$PASS 'https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi' > $TMPFILE
if grep -q 'If you have forgotten your login' $TMPFILE
then
quit 2 "Eek, the login appeared to be invalid. See $TMPFILE"
fi
TOTAL=$(wc -l < $LIST)
while read URL
do
echo "Downloading $TOTAL files, currently ${URL##*/}"
curl -L -c $COOKIES -b $COOKIES -O "$URL"
(( TOTAL-- ))
done < $LIST
echo "All files downloaded. Attempting to log out."
#Logout
curl -b $COOKIES -c $COOKIES 'http://rapidshare.com/cgi-bin/premium.cgi?logout=1' > $TMPFILE
rm $COOKIES
rm $LIST
rm $TMPFILE
Similar Messages
-
I am using ALSB 3.0
If I parse the query string using the following:
$inbound/ctx:transport/ctx:request/http:query-string/text()
when the passed data is the following:
https://webservicesdev.someplace.com/testing/order/163625/results?p1=Normal&p2=Complete
I get the following string:
p1=Normal
Why does my query string not contain all of the parameters? How do I get access to the p2=Complete part of the query string?
Thanks,
DaveThank you both for your response. The problem was more related to how I was attempting to test the service. I was using a curl script on a Unix box and my query string was being truncated at the & character. Once I tried testing directly with a browser, then I was seeing the full query string.
Once I had the full query string I was able to use the following to parse the query string:
let $parsed_query_string := tokenize( $a_query_string, "&" )
["&" above is really "& amp ;" without the spaces]
Where $a_query_string had previously been assigned to string( $inbound/ctx:transport/ctx:request/http:query-string/text() )
Thanks again,
Dave
Edited by: dschmidt on Jan 25, 2011 1:53 PM -
Hi There,
After my last post about this subject I have been browsing
the web for an awnser which would enable me to get this done, but
without any success.
What I'd like is a method (javascript or php would be fine)
to get a remote xml feed from flickr to be saved locally for quick
access by spry.
I'm not a real coder, so it is hard for me to find out.
Please can anyone help?
Kind regards,
Benjaminspecht1 wrote:
> I've read the article, but somehow I do not know what
you mean...
The cURL script in that article acts as a proxy for a remote
XML feed.
If your hosting company hasn't disabled allow_url_fopen, you
can create
an even simpler script:
<?php
$url = '
http://www.example.com/my.xml';
$remote = file_get_contents($url);
header('Content-type:text/xml');
echo $remote;
?>
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
've got code for a geeklet to display current and forecast weather. Here's what the output looks like now:
Now | Fair, 32F Tomorrow | Sunny, 32|21F
I'm trying to accomplish two goals:
1. add degree symbols between the temp and the "f"
2. break "now" and "tomorrow" onto two different lines
Code is below. Anyone? (Obviously what I don't' know about shell commands, UNIX, and life could fill multiple volumes.
Thanks in advance,
Proofrock
#!/bin/sh
normal='[0m'
bold='[1m'
italic='[3m'
underline='[4m'
boldOff='[22m'
italicOff='[23m'
underlineOff='[24m'
fgBlack='[30m'
fgRed='[31m'
fgGreen='[32m'
echo "Now | ${fgRed}\c"
curl --silent "http://weather.yahooapis.com/forecastrss?p=USVA0023&u=f" | grep -e "Forecast:" -A2 -B2 |tail -n 4 | grep -v orecast | sed -e 's/
//' -e 's/
//' | sed -n -E '2n;s/(.+)[ ]\-[ ](.)\..:[ ](0-9).:[ ](0-9+)/'"$normal"' Tomorrow | '"$fgRed "'\2, \3|\4 f'"$normal"'/;p' | tr '\n' ' 'Don't let your thread be dragged off on a tangent.
The problem is that your "geektool" is just a crude hack and I don't like such things. If you run just the curl command, you'll see that the output is XML - an RSS feed. That is a structured, parseable document. There is no need for sed scripts.
Here is a little Perl script that runs curl, gets the content, feeds it into a simple XML parser, and prints it out nicely. I think you will agree that it is far more readable than sed.
#!/usr/bin/perl -w
use strict;
use Term::ANSIColor;
use XML::Simple;
my $xml =
`/usr/bin/curl --silent "http://weather.yahooapis.com/forecastrss?p=USVA0023&u=f"`;
my $data = XMLin($xml);
my $current = $data->{channel}->{item}->{'yweather:condition'};
my $forecast = $data->{channel}->{item}->{'yweather:forecast'};
printf "Current conditions: %s%s, %d° F%s
color('bold'),
$current->{text}, $current->{temp},
color('reset');
printf "Today: %s%s, low %d° F, high %d° F%s
color('bold'),
$forecast->[0]->{text}, $forecast->[0]->{low}, $forecast->[0]->{high},
color('reset');
printf "Tomorrow: %s%s, low %d° F, high %d° F%s
color('bold'),
$forecast->[1]->{text}, $forecast->[1]->{low}, $forecast->[0]->{high},
color('reset');
I encourage you to run the curl script yourself to look at the output. There is a wealth of information in that XML data you can display. I have hard-coded 'F' for temperature units, but you could easily extract the units from the data. -
Applescript Safari Find action
Hi im new to applescript and im just wondering if anyone can help me out with my problem...
i was wondering if someone can show me how to make applescript continuously refresh a page in safari and everytime it refereshes a page.. it performs the "find" action to look for a certain text... and if its not there it repeats the "refresh and find" action until the text finally appears on the page - in which case the script would stop while the text im looking for remains highlighted.hi there,
thank you for your reply.. but im not entirely sure how to adapt that cURL script to what i want to do.
basically while safari is open... i want the script to find lets say for example the number 164 (which keeps disappearing and appearing randomly on the page)
the script may be something along these lines:
tell application "Safari" to activate
tell application "System Events"
click menu item 8 of ((process "Safari")'s (menu bar 1)'s ¬
(menu bar item "Develop")'s (menu "Develop")'s ¬
(menu item "User Agent")'s (menu "User Agent"))
tell process "Safari"
repeat until name = "1 match" --on safari when you try and find something it will either say "not found"
or "1 match" or something... now i know this line is not correct so i just need help to make it so that if the find bar on safari
keeps returning "not found" then it should repeat the ones below until the find bar displays "1 match"
keystroke "r" using {command down}
keystroke "f" using {command down}
keystroke "164"
end repeat
end if
delay 5
end tell
end tell
the find bar or whatever its called looks something like this when the text is not on the page it will say "not found" like this image here: http://i30.tinypic.com/2hpr8yq.png
sorry if my message is getting long but basically my question now is... how do i make the message that gets displayed in that find bar the variable that determines whether the script should be repeated or stopped if a match or no match is found... let me know if im not making any sense lol. -
Howdy All,
I am trying to work through the iTunes U Admin's guide directions on how to upload content using the Web Service API. I have completed everything through step 2, (I believe it is page 48 in the current guide), Request an Upload URL from iTunes U. After I try to POST a file to the URL returned in step 2 the only response I receive back from the server is a 500 error. I am writing my application in C# so using a UNIX curl script to perform the file upload is not possible, and that seems to be the only thing close to sample code that I can find.
Has anybody else written some .NET code that performs the file upload in step 3 that they would be willing to share? Even Java code that I could port over to C# would be a good start. I can also post some of my own code if there is anybody that feels like taking a look at it.
Thanks,
David
Other OSCouple of pointers for you ...
First is that the documentation (last time I looked) has a bug that will prevent you from using the web services API. Here is a link to the changes you need to make:
http://discussions.apple.com/thread.jspa?threadID=899752&tstart=15
Next, when I was working through this stuff, I found learned a ton about HTTP I didn't previously know (like how to construct a valid multipart MIME doc). If it would be helpful, your POSTed doc should look pretty close to this:
Content-Type: multipart/form-data; boundary=0xKhTmLbOuNdArY
--0xKhTmLbOuNdArY"
Content-Disposition: form-data; name="file"; filename="myXMLFile.xml"
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="UTF-8"?>
<ITunesUDocument>
<ShowTree>
<KeyGroup>maximal</KeyGroup>
</ShowTree>
</ITunesUDocument>
--0xKhTmLbOuNdArY--
I would be happy to share my own code, but it might not be what you're after (I used Objective-C and Apple's NSMutableHTTPRequest Cocoa class to do my HTTP POST). I am not a C# guy, but I would bet dollars-to-donuts that C# has some kind of class that serves as a wrapper for an HTTP POST request ... you give it the HTML, it POSTs.
MacBook Pro Mac OS X (10.4.8) I lied. I'm running Leopard -
Return results of cURL shell script direct to AS?
Is there a way to return the results of a cURL shell command (which I have working fine) directly to the AS script? The result of the cURL command is a small text file.
Or am I stuck with opening the resulting file to read its contents?The solution is simple - your original shell example uses quoted strings, and you can't just copy/paste that into an AppleScript because AppleScript also uses quotes to delineate strings.
The answer lies in escaping the quotes, so that AppleScript knows to pass the actual quote symbol to the shell (and therefore onto curl) rather than have AppleScript interpret it itself.
do shell script "/usr/bin/curl --data \"browserRequest=true&lat1=43%C2%B043%2738.11%22&lat1Hemisphere=N&lon1=69%C2%B0 4 9%2752.85%22&lon1Hemisphere=W&startYear=2013&startMonth=1&startDay=1&resultForm at=csv\" http://www.ngdc.noaa.gov/geomag-web/calculators/calculateDeclination"
Note how the quotes surrounding your data are escaped.
(Note also that the above command generates a 500 error off the server because the parameter data is invalid, but I assume you can fix that) -
I want this so I can just download anything I want by just having the link and I have made a few things with shell scripts in automator before, just never anything where i need to input a value into the shell script.
Easy:
-
Hello people,
I'm new to form design and scripts (and this forum) and have run into a brick wall that I have been unable to resolve and hope, it's a simple error that only a begginer would make, and one of you can easily resolve it.
The form needs to be submitted, as a PDF form, to different people depending on who is filling out the form.
I have put in a 'choice list' and tried to write a event script but when the 'submit email' button is pressed it only seems to do the previous 'event' which sends a pdf to one person, it is not picking up a person from the 'choice list' and is not performing other actions in the script either such as the subject line and some body text. I suspect, but could be wrong, that perhaps it is the 'this.resolveNode' as I do not know what 'this' refers to, have tried a few things but none of them worked, the last thing I tried was 'choiceList' which is still inserted.
Looks like I cannot attach the document so I will copy & paste the code which I think is wrong, if anyone would like me to email them the actual document you can email me on [email protected]
<
field h="6mm" name="EmailSubmitButton1" w="34.925mm" x="168.275mm" y="85.725mm">
<field h="34.925mm" name="ListBox1" w="36.6mm" x="165.1mm" y="47.625mm"> <
ui> <
choiceList commitOn="exit" open="multiSelect"> <
border>
<?templateDesigner StyleID aped3?>
<edge stroke="lowered"/> </
border> <
margin/> </
choiceList> </
ui> <
items> <
text>ABI</text> <
text>Burwood</text> <
text>CLP</text> <
text>Lodge\ILU</text> <
text>Firthside</text> <
text>Nolan</text> </
items> <
items presence="hidden" save="1"> <
text>[email protected]</text>
<?templateDesigner isEmailSubmitObject true?>
<
ui><
button/></
ui><
font typeface="Myriad Pro"/><
caption><
value><
text>Submit by Email</text></
value><
para hAlign="center" vAlign="middle"/><
font typeface="Myriad Pro"/></
caption><
border hand="right">
<?templateDesigner StyleID apbx2?>
<
edge stroke="raised"/><
fill><
color value="212,208,200"/></
fill></
border><
bind match="none"/><
event activity="click"><
submit format="pdf" target="mailto:[email protected]" textEncoding="UTF-8"/></
event><
event activity="mouseDown"><
script contentType="application/x-javascript">oSubmit = choiceList.resolveNode("$..#submit");
cToAddr = "[email protected]"
cCCAddr = CompanyEmails.rawValue (/\-\n?/,";") .replace(/\n/g,";");
cSubLine = "Request for Leave submitted by:"
+ Name.rawvalue + " ";
cBody = Dear " + Name.rawValue + " " + "Thank you for submitting your request for leave, we will let you know if the selected dates are available as soon as possible.";
cEmailURL = "mailto:" + cToAddr + "?";
if(cCCAddr.length)
cEmailURL += "cc=" + cToAddr + "&";
cEmailURL += "subject=" + encodeURI(cSubLine) + "&body=" + encodeURI(cBody);
oSubmit.target = cEmailURL";});</
script></
event>
The code for the choice list is as follows (in case that is the error source)
<text>[email protected]</text>
<
text>[email protected]</text><
text>[email protected]</text><
text>[email protected]</text></
items><
font typeface="Myriad Pro"/><
margin bottomInset="1mm" leftInset="1mm" rightInset="1mm" topInset="1mm"/><
caption placement="top" reserve="5mm"><
font typeface="Myriad Pro"/><
para vAlign="middle"/><
value><
text>Company emails</text>
Thank You text>[email protected]</text><
text>[email protected]</text><
text>[email protected]</text><
text>[email protected]</text><
text>[email protected]</text></
items><
font typeface="Myriad Pro"/><
margin bottomInset="1mm" leftInset="1mm" rightInset="1mm" topInset="1mm"/><
caption placement="top" reserve="5mm"><
font typeface="Myriad Pro"/><
para vAlign="middle"/><
value><
text>Company emails</text>
Thank YouHi Srini
I'm showing my 'begginer status' here I copied and pasted your code in and tried to change to match my form now when I press the submit button I get a message "Submit Cancelled', now get no email at all.
Sorry I'm at a very early stage of learning.
<event activity="click" name="event__click"><
submit format="pdf" textEncoding="UTF-16" xdpContent="pdf datasets xfdf"/></
event><
event activity="preSubmit" ref="$form" name="event__preSubmit"><
script contentType="application/x-javascript">var strToAddress, strCCAddress, strSubject, strMessage
strToAddress = [email protected];
strCCAddress = ListBox1.rawValue;
strSubject = Annual Leave Application;
strMessage = Thank You for your application, it will be dealt with as soon as possible;
event.target.submitForm({cURL:"mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + strSubject + "&body=" + strMessage,cSubmitAs:"PDF",cCharset:"utf-8"});//this.resolveNode("#event").submit.target = "mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + strSubject + "&body=" + strMessage;</script></
event> -
Script Works on MacBook and Mac Mini but Not MacBook Air
I just bought a new Mac Mini and 11' MacBook Air, and I have a script that works on the former but not the later. Running it on my Air generates the error, "error "Finder got an error: Can’t set alias "My Hard Drive!:directory path:File Name copy.doc" to "FileName}doc"." number -10006 from alias "My Hard Drive!:directory path:File Name copy.doc".
Here is the script:
tell application "Finder"
set theFile to item 1 of (get selection)
set TheName to name of theFile
set duplicatedFile to (duplicate theFile) as alias
end tell
set capName to do shell script "/bin/echo " & quoted form of TheName & " | /usr/bin/awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1' | tr -cd [:alnum:]_. "
tell application "Finder" to set name of duplicatedFile to capName
set longURL to "http://domainname.com/" & capName
set curlCMD to "curl --stderr /dev/null "http://bit.ly/api?url=" & longURL & """
set bitLy to (do shell script curlCMD)
set the clipboard to bitLy
set curlFTP to "curl -T " & quoted form of POSIX path of duplicatedFile & space & quoted form of ("ftp://unsername:[email protected]/path/" & capName)
do shell script curlFTP
tell application "Finder" to move (duplicatedFile as alias) to trashThere is a problem with duplicate names.
!http://farm2.static.flickr.com/1283/5188829536_841015b22c.jpg!
I am not sure what statement failed for you. Please clarify if I guessed wrong.
I did encounter some problem with the exclamition point in a name.
There could be a problem with exclamation point in a url, but didn't try.
You could use unix to do the rename.
tell application "Finder"
set theFile to item 1 of (get selection)
set TheName to name of theFile
set duplicatedFile to (duplicate theFile) as alias
end tell
log duplicatedFile
set capName to do shell script "/bin/echo " & quoted form of TheName & " | /usr/bin/awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1' | tr -cd [:alnum:]_. "
-- Use unix to rename
set unixName to POSIX path of duplicatedFile
log "unixName=" & unixName
set baseP to do shell script "dirname " & quoted form of unixName
log "baseP=" & baseP
set baseN to do shell script "basename " & quoted form of unixName
set baseN to quoted form of baseN
set baseP to quoted form of baseP
-- Rename the file.
set what to do shell script "cd " & baseP & "; " & "mv " & baseN & " " & capName
-- tell application "Finder" to set name of unixName to capName
log "what=" & what
set longURL to "http://domainname.com/" & capName
log "longURL=" & longURL
set curlCMD to "curl --stderr /dev/null \"http://bit.ly/api?url=" & longURL & "\""
log "curlCMD=" & curlCMD
set bitLy to (do shell script curlCMD)
set the clipboard to bitLy
set curlFTP to "curl -T " & quoted form of POSIX path of duplicatedFile & space & quoted form of ("ftp://unsername:[email protected]/path/" & capName)
do shell script curlFTP
tell application "Finder" to move (duplicatedFile as alias) to trash
Robert -
I was looking for a way to access my Google Tasks, eventually to put into a widget for Awesome WM, so I created this script. it's based on http://privacylog.blogspot.com/2010/07/ … tasks.html but has some changes. That script created an e-mail that got sent to your spam folder, where mine will sort out the list, make it readable, and print it out of stdout. This also saves the list in your home directory.
#!/bin/bash
cd $HOME
curl https://www.google.com/accounts/ClientLogin \
-d Email=[email protected] \
-d Passwd=YOUR PASSWORD \
-d source=privacylog \
-d service=goanna_mobile > token
AUTH=$(sed -n 's/Auth=/auth=/p' token)
HEADER="Authorization: GoogleLogin $AUTH"
URL="https://mail.google.com/tasks/ig"
curl --header "$HEADER" "$URL" > tasks
grep -o "\"\(name\|task_date\|notes\)\":\"[^\"]*\"" tasks > templist
grep "name" templist | awk -F : '{print $2}' > list
rm templist
cat list | awk -F \" '{print $2}' > betterlist
#removes a blank line and task list name
#if you don't have the blank line and task list name
#you may want to remove these two lines
sed -i '$d' betterlist
sed -i '$d' betterlist
cat betterlist > list
#to only print the list, not save the list,
#uncomment the list in the next line
rm token tasks betterlist #listTry Google support.
http://mail.google.com/mail/help/tasks/ -
Ideas for a conky weather script ...
Here are the 2 best sources for weather updates for me :
http://www.google.ca/search?sourceid=ch … chicoutimi (google)
or
http://www.meteomedia.com/weather/CAQC0107 (most known weather website/tv-channel of my country)
What would be the best grep ou curl ? Got ideas to build that script ?
Google seem limited but I could show pictures on my desktop directly maybe,
Meteomedia as less nice GUI for that ...Meskarune wrote:check out the conky forcast package in aur
If you install the package you'll find a conkyrc/template file example in /usr/share/conkyforecast/example
Also have a look at the conky hardcore website, it details quite a lot user setups for this script, a good example is here: http://conky.linux-hardcore.com/?page_id=2487
Cheers -
[SOLVED] Beginners' Guide stumped on pacman -Syyu curl
I'm a total green noob on Arch and am going through the Beginners' Guide. I'm on the section about rankmirrors and am at pacman -Syyu curl and am getting the following:
Is this normal? Is this the part where I continue to edit my mirrorlist and comment and uncomment servers until I don't get the Unauthorized error any longer?
Thanks.
Last edited by EdTheUniqueGeek (2012-04-27 23:53:53)EdTheUniqueGeek wrote:I'm a total green noob on Arch [...] I'm on the section about rankmirrors [...]
If you're new to Arch don't you think that sticking to basic bulletproof setup would be wise and then learn new stuff? If you try all things that are not necessary there is high risk of breaking system and you wont even have a clue where start to look for solution. Back in my first days with Arch I didn't even consider such things like mirror rank - goal was to setup working system. My advice is - choose manually mirror that have low sync delay from http://www.archlinux.org/mirrors/status/ and focus on major things. Good luck and feel welcome on the forum
EdTheUniqueGeek wrote:I am in the process I trying the shell script from adamrehard suggestion.
Again - pick rit or kernel.org mirror - you can be pretty sure they are working right now, for troubleshooting you can even choose archlinux.org (but change it for real usage) find out if it's not the http/ftp thing like people earlier noticed and work the problem with your configuration, the problem is not mirror choosing
Last edited by masteryod (2012-04-27 14:53:33) -
Pkgman - a bash script for local package and PKGBUILD management
hi all,
here is a script which manages a local repository and lets you edit
PKGBUILDs and other related files, automatically generates checksums,
build packages, add them to your local repo and so on.
it also has AUR support for submitting tarballs, leaving comments, etc.
get it from here:
http://sourceforge.net/projects/pkgman/
and AUR package:
http://aur.archlinux.org/packages.php?ID=17100
you need abs, curl and pacman and optionally namcap and desktop-file-utils.
RTFM online:
http://sourceforge.net/apps/mediawiki/p … n_man_page
first of all copy the pkgman.conf and AUR.conf files from /usr/share/pkgman to ~/.config/pkgman/ or ${XDG_CONFIG_HOME}/pkgman - if ${XDG_CONFIG_HOME} is set,
edit these two files and then run
pkgman --runmefirst
pkgman doesn´t install anything. if you want it just builds the package and moves it to your local repository. install it then with pacman.
it also has no dependency handling. there are many other tools which provide this.
the main intention was to keep track of package versions, different PKGBUILD versions and own AUR submitted tarballs; also to keep a clean local repository and clean build directories.
pkgman is stable now. i´m using it for months without any issues.
however, if there are problems or feedback please post them here.
vlad
changelog:
version 2.4:
*pkgman now respects the PKGDEST and SRCDEST variables from makepkg.conf. (though it still moves the src.tar.gz and .pkg.tar.gz to package backup directory).
version 2.5:
*pkgman uses PKGDEST if SRCDEST not set in makepkg.conf.
version 2.6 -> r26:
*changed version system: version 2.6 is now r26!
*minor changes: > pkgman uses now the $SHELL variable.
> new and more comprehensible manpage description (thanks to bender02)
version r27:
*changed SRCDEST since it's only a cache dir. all files (pkg.tar.gz and src.tar.gz) go to PKGDEST.
version r28:
*added new variable ShellCommand to pkgman.conf. Default is $SHELL.
*One might use an external application (like screen or xterm) to switch to build directory and edit files simultaneously.
version r30:
*minor changes. nothing crucial
r32: *OverwriteExistingPackage isn't used anymore. one can delete it from ~/.config/pkgman/pkgman.conf.
*minor changes
version r33:
*"-l|--list" also shows installed package version and available ABS/AUR PKGBUILD version for given package.
*"-a|--abs" can now also be used with other options (like "-e")
r39: * when backing up src.tarballs it asks whether to backup the source file or not
* more detailed "--list" option - also shows if package is installed or not and available ABS/AUR version
* added prompt to clean up directory after makepkg
* when checking pkg.tar.gz also possibility to check for conflicts with files of already installed packages
* use $PAGER instead of less
* --help directly shows the manpage
* --shorthelp shows a brief usage overview
* added a custom prompt, but only when using bash (is somehow experimental - works fine here for me)
* minor internal changes
* pkgman also reads ~/.aurvote file for getting aur name and password. if one already uses aurvote then there is no need for the
~/.config/pkgman/AUR.conf file.
r40: * new manual page & rewrite of usage function
* both option "--flush" and "--flushall" were omitted in favor of the more versatile "--cleanup" option
* pkgman <packagename> checks now if <packagename> is owned by user
* backup option after each editing
* added license
* minor internal changes
r41: * just small bug fixes, nothing crucial.
r42: * more bugs fixed.
r45: * new options added:
> --listversions: list local and available versions of installed packages from LocalPackages directory
> --getownpackages: synchronize local own packages with AUR
* added new variable in pkgman.conf:
> ListOutputInPager: output of, for example, "--list" or "--own" is piped into $PAGER
* added a new optional dependency "desktop-file-utils" for validating desktop entry files
* also supports now auto-generation of sha sums not only md5
* internal fixes due to AUR interface changes:
> use of json interface
> correct parsing of package category
* added 2 proto files (located under /usr/share/pacman):
> proto.desktop: a template for *.desktop files
> PKGBUILD-lib32.proto: a template for lib32 packages for x86_64
* some code changes and fixes
r46: * added new option to pkgman.conf (AutoGenerateSums).
> if AutoGenerateSums=no then pkgman asks whether to generate checksums or not.
> if set to yes it behaves like in former versions.
r52: * "--getownpackages" with more than 100 packages works again
* added new option "--cachecopy":
For each package in CacheCopyList (new variable in pkgman.conf) get existing package from pacman's cache directory - if
CopyPkgFromCache (new variable in pkgman.conf) is set to yes - and/or create a source tarball of PKGBUILD and related files from ABS -
if CopySrcFromABS (new variable in pkgman.conf) is set to yes - and copy them to package backup directory.
* added new variables to pkgman.conf:
> "CacheCopyList=file" - batch backup file, one package per line - default location is "$HOME/.config/pkgman/package.list".
> "CopySrcFromABS=[yes|no]"
> "CopyPkgFromCache=[yes|no]"
* some bugfixes
* docs completed
* CacheCopyList should look like
package1
package2
#this is a comment
! this too
package3
!package4
r54: * renamed "--listversions" option to "--diffversions". makes more sense!
from the man page:
pkgman --diffversions
Show differing ABS/AUR versions of installed packages from LocalPackages.
r55: * minor changes.
r57: * testing release
* added a new option "--rollback":
"pkgman <packagename> --rollback" - checks http://arm.kh.nu for available package versions,
lets you choose one, fetches the package and
moves it to the <packagename> backup directory (if "--repoadd" is used).
r59: * stable release
* new option "--rollback" (see r57):
it checks http://arm.kh.nu (Arch Rollback Machine) for available package versions,
downloads chosen file and moves it to local repository (if "-r|--repoadd" is used).
* posting files/comments/etc to AUR should work now again.
r65: *stable release
* new option "-M,--meta" to create metapackages and add them and their dependencies to local repository.
it searches for deps inside the backup directories, pacman's cache and if the packages are not available, it tries to fetch the missing
dependencies from the Arch Rollback Machine site (http://arm.kh.nu).
r66: * minor fixes
r68: * some bugfixes
* "--repoadd" and "--Reporemove" now accurately removes old packages from LocalRepository
r69: * small bugfixes when listing packages with similar names
* curl retries now 5 times if connection is not established
r75: * "--cachecopy" does not try to dl sourcefiles when backing up ABS PKGBUILDs
* some work on package splitting
* further internal changes
r76: * minor mistakes with "ln" purged
r79: * mostly small changes
* "--cleanup" now also removes uninstalled packages from LocalRepository
r81 & r80: * added AUR v1.6.0 support (use more json)
* small ARM changes ("--rollback")
r85:
* pkgman supports pkg.tar.xz packages
* some code rewrite, bugs purged (hopefully)
r113:
* pkgman now supports building split packages through makepkg.
If you already use pkgman you need to rerun "pkgman --runmefirst" after updating.
* new "-t,--template" option ("pkgman <packagename> --template <alt. packagename> [--pkgbuildversion <version>] [options]").
Useful to create a new PKGBUILD and use an existing one as a template.
* new option: "--conf /path/to/alternate/conf/file" - Specify another configuration file.
* pkgman now uses ${XDG_CONFIG_HOME}/pkgman or $HOME/.config/pkgman - if first not set - as the default location for its conf files.
r116:
* check inet conection when submitting src tarballs to AUR
* some bugs
* updated manpage on sf
For further details please read the manual page.
Last edited by DonVla (2010-04-28 11:56:59)I'm having some troubles with it (perhaps missing dependencies, and forgotten hardcoded dirs?):
jan@aconcagua 8:20PM ~ % pkgman --runmefirst
/usr/bin/pkgman: line 77: /home/jan/apps/skripte/archscripts/pkgman/share/pkgman/color.bash: No such file or directory
/usr/bin/pkgman: line 1293: initcolor: command not found
/usr/bin/pkgman: line 312: highlight: command not found
/usr/bin/pkgman: line 312: error: command not found
/usr/bin/pkgman: line 313: highlight: command not found
/usr/bin/pkgman: line 313: error: command not found
/usr/bin/pkgman: line 314: highlight: command not found
/usr/bin/pkgman: line 314: error: command not found
/usr/bin/pkgman: line 315: highlight: command not found
/usr/bin/pkgman: line 315: error: command not found
/usr/bin/pkgman: line 317: error: command not found
/usr/bin/pkgman: line 318: error: command not found
/usr/bin/pkgman: line 321: highlight: command not found
/usr/bin/pkgman: line 321: msg: command not found
/usr/bin/pkgman: line 329: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
touch: cannot touch `/bin/.pkgman.registered': Permission denied
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 332: list: command not found
/usr/bin/pkgman: line 337: msg: command not found
curl: option --output: requires parameter
curl: try 'curl --help' or 'curl --manual' for more information
^C/usr/bin/pkgman: line 209: cleanoutput: command not found
/usr/bin/pkgman: line 209: cleanoutput: command not found
(I terminated with ctrl-c).
EDIT: errors resolved by correcting the path $HOME/apps/skripte/archscripts/pkgman/share/pkgman to /usr/share/pkgman in the pkgman itself.
Last edited by bender02 (2008-05-23 01:28:58) -
Can anybody fix this apple script for me so all the responses work
iv been working on a jarvis wake up script and iv continued to add on commands to if theResponce parts of the script but now most of them wont work and i get a syntax if i dont have like 8 end if's at the end of the script could somebody please overview it, fix the script and resubmit it to me in the comments. will be so grateful if somebody fixes this pleasee.!!!!
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
say "It is " & getTimeInHoursAndMinutes() using "Tom"
on getTimeInHoursAndMinutes()
set timeStr to time string of (current date)
set Pos to offset of ":" in timeStr
set theHour to characters 1 thru (Pos - 1) of timeStr as string
set timeStr to characters (Pos + 1) through end of timeStr as string
-- Get the "minute"
set Pos to offset of ":" in timeStr
set theMin to characters 1 thru (Pos - 1) of timeStr as string
set timeStr to characters (Pos + 1) through end of timeStr as string
--Get "AM or PM"
set Pos to offset of " " in timeStr
set theSfx to characters (Pos + 1) through end of timeStr as string
return (theHour & ":" & theMin & " " & theSfx) as string
end getTimeInHoursAndMinutes
set CityCode to 1098081
set t_format to "C"
set v_format to "S"
set a_format to "Y"
set IURL to "http://weather.yahooapis.com/forecastrss?w=" & CityCode
set file_content to (do shell script "curl " & IURL)
--looking for the line with actual condition
set theText to text ((offset of "yweather:condition" in file_content) + 1) thru -1 of file_content
set sub_1 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set actual_condition to text 1 thru ((offset of "\"" in sub_1) - 1) of sub_1
set sub_1a to text ((offset of "temp=" in sub_1)) thru -1 of sub_1
set sub_1b to text ((offset of "\"" in sub_1a) + 1) thru -1 of sub_1a
set actual_temp to text 1 thru ((offset of "\"" in sub_1b) - 1) of sub_1b
if t_format is equal to "C" then
set actual_temp to (5 / 9) * (actual_temp - 32) as integer
end if
set theText to text ((offset of "yweather:forecast" in file_content) + 1) thru -1 of file_content
set sub_2 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set today_min_temp to word 9 of sub_2
set today_max_temp to word 12 of sub_2
if t_format is equal to "C" then
set today_min_temp to (5 / 9) * (today_min_temp - 32) as integer
set today_max_temp to (5 / 9) * (today_max_temp - 32) as integer
end if
set sub_3 to text ((offset of "text" in sub_2) + 1) thru -1 of sub_2
set sub_4 to text ((offset of "\"" in sub_3) + 1) thru -1 of sub_3
set today_forecast to text 1 thru ((offset of "\"" in sub_4) - 1) of sub_4
set sub_5 to text ((offset of "yweather:forecast" in sub_4) + 1) thru -1 of sub_4
set sub_6 to text ((offset of "\"" in sub_5) + 1) thru -1 of sub_5
set tomorrow_min_temp to word 9 of sub_6
set tomorrow_max_temp to word 12 of sub_6
if t_format is equal to "C" then
set tomorrow_min_temp to (5 / 9) * (tomorrow_min_temp - 32) as integer
set tomorrow_max_temp to (5 / 9) * (tomorrow_max_temp - 32) as integer
end if
set sub_7 to text ((offset of "text" in sub_6) + 1) thru -1 of sub_6
set sub_8 to text ((offset of "\"" in sub_7) + 1) thru -1 of sub_7
set tomorrow_forecast to text 1 thru ((offset of "\"" in sub_8) - 1) of sub_8
if a_format is equal to "Y" then
say "The current conditions in Perth are " & actual_condition & " ,and the current temperture is " & actual_temp & " degrees"
end if
if v_format is equal to "L" then
say "Today it will be : " & today_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees " using "Tom"
else
say "Today it will be : " & today_forecast & ", between " & today_min_temp & " , and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ", between " & tomorrow_min_temp & " ,and " & tomorrow_max_temp & " degrees " using "Tom"
say "will that be all sir?"
tell application "SpeechRecognitionServer" to set theResponse to listen for {"get my mail ", "yes", "notes", "repeat", "Music", "Sleep in"}
if theResponse is "Sleep in" then
delay 6
say "Time to get up sir,or you will be late"
tell application "SpeechRecognitionServer" to set theResponse2 to listen for {"Ok pat im getting up"}
if theResponse2 is "Ok pat im getting up" then
set volume 35
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 40 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
if theResponse is "Music" then
set volume 20
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 60 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
if theResponse is "yes" then
delay 1
set theOptions to {"very good, sir, have a nice day"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if theResponse is "get my mail " then
tell application "Mail" to launch
end if
if theResponse is "notes" then
tell application "Stickies" to launch
end if
if theResponse is "repeat" then
set CityCode to 1098081
set t_format to "C"
set v_format to "S"
set a_format to "Y"
set IURL to "http://weather.yahooapis.com/forecastrss?w=" & CityCode
set file_content to (do shell script "curl " & IURL)
--looking for the line with actual condition
set theText to text ((offset of "yweather:condition" in file_content) + 1) thru -1 of file_content
set sub_1 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set actual_condition to text 1 thru ((offset of "\"" in sub_1) - 1) of sub_1
set sub_1a to text ((offset of "temp=" in sub_1)) thru -1 of sub_1
set sub_1b to text ((offset of "\"" in sub_1a) + 1) thru -1 of sub_1a
set actual_temp to text 1 thru ((offset of "\"" in sub_1b) - 1) of sub_1b
if t_format is equal to "C" then
set actual_temp to (5 / 9) * (actual_temp - 32) as integer
end if
set theText to text ((offset of "yweather:forecast" in file_content) + 1) thru -1 of file_content
set sub_2 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set today_min_temp to word 9 of sub_2
set today_max_temp to word 12 of sub_2
if t_format is equal to "C" then
set today_min_temp to (5 / 9) * (today_min_temp - 32) as integer
set today_max_temp to (5 / 9) * (today_max_temp - 32) as integer
end if
set sub_3 to text ((offset of "text" in sub_2) + 1) thru -1 of sub_2
set sub_4 to text ((offset of "\"" in sub_3) + 1) thru -1 of sub_3
set today_forecast to text 1 thru ((offset of "\"" in sub_4) - 1) of sub_4
set sub_5 to text ((offset of "yweather:forecast" in sub_4) + 1) thru -1 of sub_4
set sub_6 to text ((offset of "\"" in sub_5) + 1) thru -1 of sub_5
set tomorrow_min_temp to word 9 of sub_6
set tomorrow_max_temp to word 12 of sub_6
if t_format is equal to "C" then
set tomorrow_min_temp to (5 / 9) * (tomorrow_min_temp - 32) as integer
set tomorrow_max_temp to (5 / 9) * (tomorrow_max_temp - 32) as integer
end if
set sub_7 to text ((offset of "text" in sub_6) + 1) thru -1 of sub_6
set sub_8 to text ((offset of "\"" in sub_7) + 1) thru -1 of sub_7
set tomorrow_forecast to text 1 thru ((offset of "\"" in sub_8) - 1) of sub_8
if a_format is equal to "Y" then
say "The current conditions in Perth are " & actual_condition & " ,and the current temperture is " & actual_temp & " degrees"
end if
if v_format is equal to "L" then
say "Today it will be : " & today_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees " using "Tom"
else
say "will that be all sir?"
tell application "SpeechRecognitionServer" to set theResponse3 to listen for {"get my mail ", "yes", "notes", "Music"}
if theResponse3 is "Music" then
set volume 20
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 60 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
else
if theResponse3 is "get my mail " then
tell application "Mail" to launch
end if
if theResponse3 is "yes" then
delay 1
set theOptions to {"very good, sir, have a nice day"}
set theChoice to some item of theOptionsWhat you do in this situation, is split the file into parts.
Start with:
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
Add in a few lines of code to this file and see what happens.
add the on run, this would be clearer. It is the default on unit to run.
on run
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
end run
Now, it is time for debugging.
It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on. Here is an example.
Author: rccharles
For testing, run in the Script Editor.
1) Click on the Event Log tab to see the output from the log statement
2) Click on Run
on run
-- Write a message into the event log.
log " --- Starting on " & ((current date) as string) & " --- "
-- debug lines
set desktopPath to (path to desktop) as string
log "desktopPath = " & desktopPath
end run
Maybe you are looking for
-
Ipod 5th gen, video 30bg, will sync/restore, won't play
I am running Windows 7, with all updates (as of 3/14/2014) have itunes 11.1.5.5 showing no available updates. When I plug into the USB port, the ipod gets recognized, Itunes starts. I can see the files on the ipod. I have reset the ipod and restored.
-
Need to do a clean install after firmware update
i have to reinstall os x after the firmware update. it wont boot up just sticks on the grey logo and sinny thing.... grrrr will it be ok just to archive and install just leopard instead of tiger, then disc 2(the apps) then leopard??
-
Illustrator CS3 crashes under Mac OS X 10.5.5
Since some days I encountered crashes everytime I want to save or print a file. I didn't installed the last days any Plug In or program that could affect Illustrator. I tried to reset any preference file in any directory. - It didn't works. I tried t
-
What do I need to look for on my MacBook Pro to see if it will support Mountain Lion?
I see some MacBooks will not be able to get Mountain Lion. Which and where can I look to find out?
-
Errors with the global conversion rule for the field 0SOURSYSTEM.
Hello Gurus, We are implementing CRM Activities. I enhanced the data source and when I add new info objects to 0SAL_DS01 DSO and trying to activate I'm getting there errors. Can some one please help me out in this problem? Error in global convers