Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch to Nibbels 1.5.2 #1

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ ocDownloader is an application for [ownCloud](https://owncloud.org). ocDownloade
***If you are interested, go to [ocDownloader Transifex Project](https://www.transifex.com/projects/p/ocdownloader)***

## ARIA2 installation
Please visit : [OCDownloader:Requirements (Linux Debian - JESSIE)](https://wiki.sgc-univ.net/index.php/OCDownloader:Requirements_%28Linux_Debian_-_JESSIE%29)
Please visit : [OCDownloader:Requirements (Linux Debian - JESSIE)](https://web.archive.org/web/20160912231334/https://wiki.sgc-univ.net/index.php/OCDownloader:Requirements_(Linux_Debian_-_JESSIE))
Everything you need to install ARIA2 and to run aria2c as a daemon !

## Other articles
Download YouTube video : [OCDownloader:Install The YouTube-DL Provider](https://wiki.sgc-univ.net/index.php/OCDownloader:Install_The_YouTube-DL_Provider)
*Note : You have to install Python on your server. This a requierement for youtube-dl.*
ARIA2 fallback : [OCDownloader:Aria2 fallback using CURL directly (Requirements)](https://wiki.sgc-univ.net/index.php/OCDownloader:Aria2_fallback_using_CURL_directly_%28Requirements%29)
Download YouTube video : [OCDownloader:Install The YouTube-DL Provider](https://wiki.sgc-univ.net/index.php/OCDownloader:Install_The_YouTube-DL_Provider)
Another Reference : [OCDownloader:Install The YouTube-DL](https://rg3.github.io/youtube-dl/download.html)
*Note : You have to install Python on your server. This a requierement for youtube-dl.*

ARIA2 fallback : [OCDownloader:Aria2 fallback using CURL directly (Requirements)](https://web.archive.org/web/20160912225929/https://wiki.sgc-univ.net/index.php/OCDownloader:Aria2_fallback_using_CURL_directly_(Requirements))

## CURL installation hint
The File SERVER/fallback.sh still needs chmod 740. This is no perfect solution but seems to work.

## Translators
- Polish : Andrzej Kaczmarczyk
Expand All @@ -36,8 +41,10 @@ Xavier Beurois
- Wiki : [Visit SGC-Univ.Net Wiki!](https://wiki.sgc-univ.net)

## Releases notes
### v1.5.1
- Fixing minor CSS / JS bug
### v1.5.2
- Added some basic function which scans the downloads folder to make new downloads visible within Owncloud/Nextcloud
- hooked in the new function to the pageload of "Complete Downloads" and "All Downloads" (This is way from perfect but works somehow)
- removed 1.5.1 from commits because of license change.
### v1.5
- Update languages, add following languages : Persian, Chinese, Italian, Danish, Korean
- You can now upload a torrent file directly from the application
Expand Down
7 changes: 4 additions & 3 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
<id>ocdownloader</id>
<name>ocDownloader</name>
<description>Easy to use downloader client. ocDownloader now uses Aria2 to allow downloading via HTTP(S), FTP(S), YouTube videos, BitTorrent files</description>
<version>1.5</version>
<version>1.5.2</version>
<licence>AGPL</licence>
<author>Xavier Beurois</author>
<website>http://www.sgc-univ.net</website>
<bugs>https://github.com/DjazzLab/ocdownloader/issues</bugs>
<repository type="git">https://github.com/DjazzLab/ocdownloader.git</repository>
<dependencies>
<owncloud min-version="8.0" />
<php min-version="5.5.0" />
<owncloud min-version="9.0" />
<nextcloud min-version="11" max-version="12" />
<php min-version="5.3.0" />
<lib>curl</lib>
<os>Linux</os>
</dependencies>
Expand Down
30 changes: 29 additions & 1 deletion controller/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Index extends Controller
private $AllowProtocolFTP = null;
private $AllowProtocolYT = null;
private $AllowProtocolBT = null;
private $DownloadsFolder = null;

public function __construct ($AppName, IRequest $Request, $CurrentUID, IL10N $L10N)
{
Expand Down Expand Up @@ -63,6 +64,13 @@ public function __construct ($AppName, IRequest $Request, $CurrentUID, IL10N $L1
$this->Settings->SetKey ('AllowProtocolBT');
$this->AllowProtocolBT = $this->Settings->GetValue ();
$this->AllowProtocolBT = is_null ($this->AllowProtocolBT) || \OC_User::isAdminUser ($this->CurrentUID) ? true : strcmp ($this->AllowProtocolBT, 'Y') == 0;

$this->Settings->SetTable ('personal');
$this->Settings->SetUID ($this->CurrentUID);

$this->Settings->SetKey ('DownloadsFolder');
$this->DownloadsFolder = $this->Settings->GetValue ();
$this->DownloadsFolder = '/' . (is_null ($this->DownloadsFolder) ? 'Downloads' : $this->DownloadsFolder);
}

/**
Expand Down Expand Up @@ -94,6 +102,7 @@ public function Add ()
*/
public function All ()
{
self::syncDownloadsFolder();
return new TemplateResponse ('ocdownloader', 'all', [
'PAGE' => 1,
'CANCHECKFORUPDATE' => $this->CanCheckForUpdate,
Expand All @@ -107,6 +116,7 @@ public function All ()
*/
public function Completes ()
{
self::syncDownloadsFolder();
return new TemplateResponse ('ocdownloader', 'completes', [
'PAGE' => 2,
'CANCHECKFORUPDATE' => $this->CanCheckForUpdate,
Expand Down Expand Up @@ -169,12 +179,30 @@ public function Removed ()
{
if (strcmp ($this->WhichDownloader, 'ARIA2') != 0)
{
return $this->L10N->t ('You are using %s ! This page is only available with the following engines : ', $this->WhichDownloader) . 'ARIA2';
//return $this->L10N->t ('You are using %s ! This page is only available with the following engines : ', $this->WhichDownloader) . 'ARIA2';
}
return new TemplateResponse('ocdownloader', 'removed', [
'PAGE' => 6,
'CANCHECKFORUPDATE' => $this->CanCheckForUpdate,
'WD' => $this->WhichDownloader
]);
}
/**
* Testfunction by Nibbels
* Fix for https://github.com/DjazzLab/ocdownloader/issues/44
*/
protected function syncDownloadsFolder () {
$user = $this->CurrentUID; //or normally \OC::$server->getUserSession()->getUser()->getUID();
$scanner = new \OC\Files\Utils\Scanner( $user , \OC::$server->getDatabaseConnection(), \OC::$server->getLogger() );
$path = '/'.$user.'/files/'.ltrim($this->DownloadsFolder,'/\\');
try {
$scanner->scan($path);
} catch (ForbiddenException $e) {
//$arr['forbidden'] = 1;
//"<error>Home storage for user $user not writable</error>" "Make sure you're running the scan command only as the user the web server runs as"
} catch (\Exception $e) {
//$arr['exception'] = 1;
//'<error>Exception during scan: ' . $e->getMessage() . "\n" . $e->getTraceAsString() . '</error>');
}
}
}