Skip to content

Commit

Permalink
dadapush-feed init
Browse files Browse the repository at this point in the history
  • Loading branch information
ysykzheng committed Jul 14, 2019
0 parents commit 04f3b8e
Show file tree
Hide file tree
Showing 5 changed files with 634 additions and 0 deletions.
107 changes: 107 additions & 0 deletions .gitignore
@@ -0,0 +1,107 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Maven template
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

### Java template
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
107 changes: 107 additions & 0 deletions pom.xml
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.dadapush</groupId>
<artifactId>dadapush-feed</artifactId>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifest>
<mainClass>com.dadapush.feed.FeedPush</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.dadapush.client</groupId>
<artifactId>dadapush-client</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.9</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.199</version>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>be.ceau</groupId>
<artifactId>opml-parser</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.26</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.26</version>
</dependency>
</dependencies>

</project>
23 changes: 23 additions & 0 deletions readme.md
@@ -0,0 +1,23 @@
# dadapush-feed
send RSS od Atom feeds to DaDaPush

# Usage
```
usage: java -jar dadapush-feed-[VERSION]-jar-with-dependencies.jar
-d,--debug turn on debug mode
-h,--help print help message
-p,--path <path> database path
-T,--token <token> channel token
-u,--url <url> feed url
```

## manual:
```
java -jar dadapush-feed-1.0.0-jar-with-dependencies.jar -p "[YOUR_FILE_PATH]/db" -T YOUR_TOKEN -u [YOUR_FEED_URL]
```

## crontab:
```
*/5 * * * * java -jar dadapush-feed-1.0.0-jar-with-dependencies.jar -p "[YOUR_FILE_PATH]/db" -T YOUR_TOKEN -u [YOUR_FEED_URL]
```

87 changes: 87 additions & 0 deletions src/main/java/com/dadapush/feed/FeedInfo.java
@@ -0,0 +1,87 @@
package com.dadapush.feed;

import java.util.Date;

class FeedInfo {

private String title;
private String url;
private String description;
private Date publishedDate;

public FeedInfo(String title, String url, String description, Date publishedDate) {
this.title = title;
this.url = url;
this.description = description;
this.publishedDate = publishedDate;
}

public FeedInfo() {
}

public Date getPublishedDate() {
return publishedDate;
}

public void setPublishedDate(Date publishedDate) {
this.publishedDate = publishedDate;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

FeedInfo feedInfo = (FeedInfo) o;

if (title != null ? !title.equals(feedInfo.title) : feedInfo.title != null) {
return false;
}
return url != null ? url.equals(feedInfo.url) : feedInfo.url == null;
}

@Override
public int hashCode() {
int result = title != null ? title.hashCode() : 0;
result = 31 * result + (url != null ? url.hashCode() : 0);
return result;
}

@Override
public String toString() {
return "FeedInfo{" +
"title='" + title + '\'' +
", url='" + url + '\'' +
", description='" + description + '\'' +
", publishedDate=" + publishedDate +
'}';
}
}

0 comments on commit 04f3b8e

Please sign in to comment.