Skip to content

Commit

Permalink
SendToMyJD2: first version (#21)
Browse files Browse the repository at this point in the history
New feed entries could be add automatically to you own instance of jDownloader2 by the official JDownloader2 API and service my.jdownloader.org
  • Loading branch information
cn-tools authored May 27, 2024
1 parent 5f7b6a6 commit 08835e7
Show file tree
Hide file tree
Showing 10 changed files with 933 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ This plug-in helps you to filter feed entries by keywords parsed by the feed ent

This plug-in remove emojis in the title of newly added feed entries.

### SendToMyJD2

Send links of new feed entries to your jDownloader2 instance\
Have a look into the [DOCUMENTATION](https://github.com/cn-tools/cntools_FreshRssExtensions/tree/master/xExtension-SendToMyJD2#documentation)

### YouTubeChannel2RssFeed

Transfer on the fly a YouTube URL into an RSS Feed\
Have a look into the [DOCUMENTATION](https://github.com/cn-tools/cntools_FreshRssExtensions/tree/master/xExtension-YouTubeChannel2RssFeed)
Have a look into the [DOCUMENTATION](https://github.com/cn-tools/cntools_FreshRssExtensions/tree/master/xExtension-YouTubeChannel2RssFeed#documentation)

## Translations

Expand Down
2 changes: 2 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ files:
translation: /xExtension-FeedTitleBuilder/i18n/%two_letters_code%/ext.php
- source: /xExtension-FilterTitle/i18n/en/ext.php
translation: /xExtension-FilterTitle/i18n/%two_letters_code%/ext.php
- source: /xExtension-SendToMyJD2/i18n/en/ext.php
translation: /xExtension-SendToMyJD2/i18n/%two_letters_code%/ext.php
- source: /xExtension-YouTubeChannel2RssFeed/i18n/en/ext.php
translation: /xExtension-YouTubeChannel2RssFeed/i18n/%two_letters_code%/ext.php
21 changes: 21 additions & 0 deletions xExtension-SendToMyJD2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Clemens Neubauer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
66 changes: 66 additions & 0 deletions xExtension-SendToMyJD2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# FreshRSS SendToMyJD2

This add on for FreshRSS send links to your myJDownloader2 instance you defined in the config.\
Required FreshRSS version at least v1.20

## Documentation

You can define several configurations line by line in a text field. The search is performed based on your configuration within a category or feed and, if necessary, combined with the defined RegEx check. The base URL of the feed entry is used as the link that is sent to jDownloader2 if the defined checks apply.

### Definations for configuration

Seperator chars: `=` and `;`. How to see in the section [Some examples](#L36)

There are some key chars available:

- `k` for key: Define which data should be checked.
- `c` for category
- `f` for feed
- `*` (star) define that each new entry should be checked. In this case the parameter `r` will probably be required.
- `v` for value: Here you define the ID of the category or feed, depending on the definition of the key. If your key is the `*`, this param is ignored.

The following chars are optional:

- `r` for regex pattern: The data from this parameter is evaluated using the PHP function [`preg_match`](https://www.php.net/manual/en/function.preg-match). The pattern is applied to the title of the new feed entry to be checked.
- `p` for package name: This text is sent as package name to your jDownloader2. Default: `empty` - in this case jDownloader build the package name
- `m`: Mark the entry as readed if it was sent to myJD2. Allowed values: `0,1`. Default value: `0`
- `a` for autostart: Set to `1` if the added link is to be downloaded immediately. Allowed values: `0,1`. Default value: `0`

**The parameters `k`, `v` and `r` are checked with an AND operation!**

For the param `p` are 2 additional special words available:

- `{userid}`: Will be replaced into the user id of the current logged in user of FreshRSS
- `{date}Ymd{/date}`: The pattern inside the date content will be executed with the php function [`date`](https://www.php.net/manual/en/function.date.php)

### Some examples

```text
k=c;v=28;p=Category28_{date}Ydm{/date} by {userid};
k=f;v=79;r=/\bjohn\b/i;p=anytext {date}Ydm{/date} by {userid}
k=*;r=/\bfreshrss\b/i;p=anytext {date}Ydm{/date} by {userid};m=1;a=1
```

### How to find out the ID of category or feed?

Have a look to the extension [ShowFeedID](https://github.com/FreshRSS/Extensions/tree/master/xExtension-showFeedID).

## Translations

- English
- German

[![Crowdin](https://badges.crowdin.net/cntools-freshrssextensions/localized.svg)](https://crowdin.com/project/cntools-freshrssextensions)

You can help me to translate my extensions to a couple of languages on [Crowdin](https://crowdin.com/project/cntools-freshrssextensions). Or send me a new translation as pull request. I am happy to see!

## Special thanks

- [Anatoliy Kultenko](https://github.com/tofika) for [`my.jdownloader.org-api-php-class`](https://github.com/tofika/my.jdownloader.org-api-php-class)

## Installation

To install an extension, download the extension archive first and extract it on your PC.\
Then, upload the specific extension(s) you want on your server.

Extensions must be in the ./extensions directory of your FreshRSS installation.
50 changes: 50 additions & 0 deletions xExtension-SendToMyJD2/configure.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<form action="<?= _url('extension', 'configure', 'e', urlencode($this->getName())); ?>" method="post">
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken(); ?>" />

<div class="form-group">
<label class="group-name" for="SendToMyJD2_email"><?= _t('ext.SendToMyJD2.config.email_label'); ?></label>
<div class="group-controls">
<input type="email" name="SendToMyJD2_email" id="SendToMyJD2_email" placeholder="[email protected]" value="<?= FreshRSS_Context::$user_conf->SendToMyJD2["email"] ?? ''; ?>" required>
</div>
</div>

<div class="form-group">
<label class="group-name" for="SendToMyJD2_password" placeholder=""><?= _t('ext.SendToMyJD2.config.password_label'); ?></label>
<div class="group-controls">
<input type="password" name="SendToMyJD2_password" id="SendToMyJD2_password" value="<?= FreshRSS_Context::$user_conf->SendToMyJD2["password_plain"] ?? ''; ?>" required>
<div><?= _t('ext.SendToMyJD2.config.password_danger'); ?></div>
</div>
</div>

<div class="form-group">
<label class="group-name" for="SendToMyJD2_device"><?= _t('ext.SendToMyJD2.config.device_label'); ?></label>
<div class="group-controls">
<input type="text" name="SendToMyJD2_device" id="SendToMyJD2_device" list="SendToMyJD2_devices" value="<?= FreshRSS_Context::$user_conf->SendToMyJD2["device"] ?? ''; ?>">
<?= $this->getDevicesDatalistHTML(); ?>
</div>
</div>

<div class="form-group">
<label class="group-name" for="SendToMyJD2_patterns"><?= _t('ext.SendToMyJD2.config.data_label'); ?></label>
<div class="group-controls">
<textarea name="SendToMyJD2_patterns" id="SendToMyJD2_patterns" wrap="off" style="white-space: nowrap;" required><?= $this->getDataPatterns(); ?></textarea>
<br /><span><?= _t('ext.SendToMyJD2.config.data_help') ?></span>
<br /><span><a href="https://github.com/cn-tools/cntools_FreshRssExtensions/tree/master/xExtension-SendToMyJD2#documentation" target="_blank"><?= _t('ext.SendToMyJD2.config.data_help_lnk_txt'); ?></a></span>
</div>
</div>

<div class="form-group">
<label class="group-name" for="SendToMyJD2_sendtestdata"><?= _t('ext.SendToMyJD2.config.testdata') ?></label>
<div class="group-controls">
<input type="checkbox" name="SendToMyJD2_sendtestdata" id="SendToMyJD2_sendtestdata" value="1">
<span><?= _t('ext.SendToMyJD2.config.testdata_hint') ?></span><a href="<?= $this->getYouTubeTestLink(); ?>" target="_blank">LINK</a>
</div>
</div>

<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?= _t('gen.action.submit'); ?></button>
<button type="reset" class="btn"><?= _t('gen.action.cancel'); ?></button>
</div>
</div>
</form>
Loading

0 comments on commit 08835e7

Please sign in to comment.