Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewCarlson committed Jun 18, 2021
0 parents commit d4d6f0d
Show file tree
Hide file tree
Showing 160 changed files with 12,569 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gradle
.idea
**/build/**
/qbittorrent/
!/server/build/install/
!/client-web/build/distributions/
!/client-web-old/build/distributions/
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf
Dockerfile eol=lf
*.sh eol=lf
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [ drewcarlson ]
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.gradle/
/.idea
!/.idea/codeStyles
out/
build/
.env
*.iml
*.ipr
*.iws
.DS_Store
qbittorrent/
local.properties
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM openjdk:13-alpine

COPY . /build-project
WORKDIR /build-project
RUN ./gradlew installShadowDist browserProductionWebpack --no-daemon

FROM openjdk:13-alpine
RUN apk add --update \
bash \
ffmpeg \
&& rm -rf /var/cache/apk/*
WORKDIR /app
COPY --from=0 /build-project/server/build/install ./install
COPY --from=0 /build-project/client-web/build/distributions ./client-web
ENTRYPOINT ["./install/server-shadow/bin/server"]
9 changes: 9 additions & 0 deletions Dockerfile-local
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM openjdk:13-alpine
RUN apk add --update \
bash \
ffmpeg \
&& rm -rf /var/cache/apk/*
WORKDIR /app
COPY server/build/install ./install
COPY client-web/build/distributions ./client-web
ENTRYPOINT ["./install/server-shadow/bin/server"]
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
AnyStream
===

![License](https://img.shields.io/github/license/drewcarlson/anystream)
![](https://img.shields.io/static/v1?label=status&message=wip&color=red)

A self-hosted streaming service for your media collection.

### Features

- Track and organize your existing media library
- Stream to all your favorite devices
- Share your library with fine-grained permissions

<details>
<summary>Screenshots</summary>

![](media/screenshot-android-home.png)
![](media/screenshot-web-home.png)

</details>

### Structure

AnyStream consists of a self-hosted server instance and various client applications that connect to it.

- [server](server) - Web server for managing and streaming media built with [Ktor](https://github.com/ktorio/ktor)
- [client](client) - Multiplatform infrastructure for AnyStream client applications built with [Mobius.kt](https://github.com/DrewCarlson/mobius.kt)
- [client-android](client-android) - Android client implementation built with [Jetpack Compose](https://developer.android.com/jetpack/compose)
- [client-web](client-web) - Web client implementation built with [Jetbrains Compose](https://github.com/JetBrains/compose-jb/)
- [data-models](data-models) - Data models shared between the server and clients
- [api-client](api-client) - Multiplatform API client for interacting with the server built with [Ktor-client](https://github.com/ktorio/ktor)

### Development

*Note: Because of the use of Jetpack Compose, only [Android Studio 2020.3.1 Arctic Fox](https://developer.android.com/studio/preview) is supported!*

- Install [Intellij IDEA](https://www.jetbrains.com/idea/) (preferred) or [Android Studio](https://developer.android.com/studio/)
- Clone this repo `git clone https://github.com/DrewCarlson/AnyStream.git`
- Open the `AnyStream` folder in your IDE

### Run locally

1. Build server `./gradlew installShadowDist`

2. Build client-web `./gradlew jsBrowserReleaseExecutableDistribution`

3. Start docker stack `docker-compose up -d`

The following services will be running:

- anystream (app): http://localhost:8888
- mongo: localhost:27017
- mongo-express: http://localhost:8081
- docker-qbittorrentvpn: http://localhost:9090


### Web Client Development

1. _(Follow Run Locally)_

2. Run the client-web webpack dev server: `./gradlew -t jsBrowserRun`

The web client with live-reload is served from http://localhost:3000.
Webpack's dev server proxies API requests to `localhost:8888`.


### Server Development

1. _(Follow Run Locally)_

2. Stop the AnyStream container: `docker-compose stop app`

3. Run the server: `./gradlew -t run`


### Other useful tasks

Build server bundle into `server/build/install/server-shadow`:
```bash
./gradlew installShadowDist
```

Build production client-web source into `client-web/build/distributions`:
```bash
./gradlew jsBrowserDistribution
```

### License

This project is licensed under AGPL-3.0, found in [LICENSE](LICENSE).
76 changes: 76 additions & 0 deletions api-client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
}

kotlin {
jvm()
js(IR) {
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
}

sourceSets {
all {
languageSettings.apply {
useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
useExperimentalAnnotation("kotlinx.coroutines.FlowPreview")
}
}
val commonMain by getting {
kotlin.srcDirs("src")
dependencies {
implementation(projects.dataModels)
implementation(libs.coroutines.core)
implementation(libs.serialization.core)
implementation(libs.serialization.json)

implementation(libs.ktor.client.core)
implementation(libs.ktor.client.json)
implementation(libs.ktor.client.serialization)
implementation(libs.korio)
}
}
val commonTest by getting {
kotlin.srcDirs("test")
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}

val jvmMain by getting {
dependencies {
implementation(project(":data-models"))
implementation(libs.ktor.client.okhttp)
}
}

val jvmTest by getting {
kotlin.srcDirs("testJvm")
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}

val jsMain by getting {
dependencies {
implementation(project(":data-models"))
implementation(libs.ktor.client.js)
}
}

val jsTest by getting {
kotlin.srcDirs("testJs")
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
Loading

0 comments on commit d4d6f0d

Please sign in to comment.