diff --git a/.expo-shared/assets.json b/.expo-shared/assets.json new file mode 100755 index 0000000..17ad228 --- /dev/null +++ b/.expo-shared/assets.json @@ -0,0 +1,4 @@ +{ + "f9155ac790fd02fadcdeca367b02581c04a353aa6d5aa84409a59f6804c87acd": true, + "89ed26367cdb9b771858e026f2eb95bfdb90e5ae943e716575327ec325f39c44": true +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..a25907f --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +node_modules/**/* +.expo/* +npm-debug.* +*.jks +*.p8 +*.p12 +*.key +*.mobileprovision +*.orig.* +web-build/ +web-report/ + +# macOS +.DS_Store + +# more stuff +*.bash + diff --git a/App.js b/App.js new file mode 100644 index 0000000..65537b9 --- /dev/null +++ b/App.js @@ -0,0 +1,40 @@ +import React from 'react'; + +// Nav stuff + +//import { createAppContainer } from 'react-navigation'; +//import { createStackNavigator } from 'react-navigation-stack'; + +import { NavigationContainer } from '@react-navigation/native'; +import { createNativeStackNavigator } from '@react-navigation/native-stack'; + +// Screens one per file to keep things clean + +import HomeScreen from './src/screens/HomeScreen'; +import AboutScreen from './src/screens/AboutScreen'; +import SettingsScreen from './src/screens/SettingsScreen'; +import FilesScreen from './src/screens/FilesScreen'; + +// Clean up of code before I fix the last little issue with it + + +const Stack = createNativeStackNavigator(); + + +function App() { + return ( + + + + + + + + + + ); +} + +//export default createAppContainer(AppNavigator); + +export default App; diff --git a/LICENSE b/LICENSE index 1e4f560..f288702 100644 --- a/LICENSE +++ b/LICENSE @@ -631,9 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Raspberry Pi Media center - - Copyright (C) 2020 Paul Malcher + + Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/README.md b/README.md index 0d429a1..d755a02 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,2 @@ # rpimc Raspberry PI Medial Center - -Designed to be used with a google chromecasts. Componets seperated into branches. - -# Current Status as of 1/10/22 - -Allot of recent work on the Frontend. A large part due to having to update the code to a newer version of expo. Backend is ok for the most part a few items to do. See issues for a break down. - -# Frontend Branch -A react native android application, acts as a remote control. This is built using -Expo. - -# Backend Branch -A Python based web service and controller chromecasts - -# Notes -Example for cloning the frontend -git clone -b frontend https://github.com/kake26/rpimc.git - -Some values still hardcoded as its a work in progress. 1.0 Release will be soon. diff --git a/app.json b/app.json new file mode 100644 index 0000000..bd64b9e --- /dev/null +++ b/app.json @@ -0,0 +1,32 @@ +{ + "expo": { + "name": "csrv", + "slug": "csrv", + "version": "1.0.0", + "orientation": "portrait", + "icon": "./assets/icon.png", + "splash": { + "image": "./assets/splash.png", + "resizeMode": "contain", + "backgroundColor": "#ffffff" + }, + "updates": { + "fallbackToCacheTimeout": 0 + }, + "assetBundlePatterns": [ + "**/*" + ], + "ios": { + "supportsTablet": true + }, + "android": { + "adaptiveIcon": { + "foregroundImage": "./assets/adaptive-icon.png", + "backgroundColor": "#FFFFFF" + } + }, + "web": { + "favicon": "./assets/favicon.png" + } + } +} diff --git a/assets/adaptive-icon.png b/assets/adaptive-icon.png new file mode 100644 index 0000000..03d6f6b Binary files /dev/null and b/assets/adaptive-icon.png differ diff --git a/assets/favicon.png b/assets/favicon.png new file mode 100644 index 0000000..e75f697 Binary files /dev/null and b/assets/favicon.png differ diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000..a0b1526 Binary files /dev/null and b/assets/icon.png differ diff --git a/assets/splash.png b/assets/splash.png new file mode 100644 index 0000000..0e89705 Binary files /dev/null and b/assets/splash.png differ diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..2900afe --- /dev/null +++ b/babel.config.js @@ -0,0 +1,6 @@ +module.exports = function(api) { + api.cache(true); + return { + presets: ['babel-preset-expo'], + }; +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..818c4ca --- /dev/null +++ b/package.json @@ -0,0 +1,32 @@ +{ + "name": "csrv", + "version": "1.0.0", + "main": "node_modules/expo/AppEntry.js", + "scripts": { + "start": "expo start", + "android": "expo start --android", + "ios": "expo start --ios", + "web": "expo start --web", + "eject": "expo eject" + }, + "dependencies": { + "@react-native-async-storage/async-storage": "~1.15.0", + "@react-navigation/native": "^6.0.6", + "@react-navigation/native-stack": "^6.2.5", + "axios": "^0.24.0", + "expo": "^44.0.3", + "expo-status-bar": "~1.2.0", + "react": "17.0.1", + "react-dom": "17.0.1", + "react-native": "0.64.3", + "react-native-elements": "^3.4.2", + "react-native-safe-area-context": "3.3.2", + "react-native-screen": "^1.0.1", + "react-native-screens": "~3.10.1", + "react-native-web": "0.17.1" + }, + "devDependencies": { + "@babel/core": "^7.12.9" + }, + "private": true +} diff --git a/src/screens/AboutScreen.js b/src/screens/AboutScreen.js new file mode 100755 index 0000000..fb45fe4 --- /dev/null +++ b/src/screens/AboutScreen.js @@ -0,0 +1,29 @@ +import React from 'react'; +import { + View, + Text, + } from 'react-native'; + + const AboutScreen = ({ navigation }) => { + + const navigationOptions = ({ navigation }) => { + return { + title: navigation.getParam('otherParam', 'About'), + headerStyle: { + backgroundColor: '#3333ff', + }, + headerTintColor: '#fff', + }; + }; + + + return ( + + About Screen{"\n"}{"\n"} + RPI Media Center Control v 1.0 beta + + ); + } + + + export default AboutScreen; \ No newline at end of file diff --git a/src/screens/FilesScreen.js b/src/screens/FilesScreen.js new file mode 100755 index 0000000..1dc01e0 --- /dev/null +++ b/src/screens/FilesScreen.js @@ -0,0 +1,72 @@ +import React, { useState, useEffect } from 'react'; +import axios from 'axios'; + +import { + View, + Text, + FlatList, // Solves the problem with the 5 movie limit in the app + } from 'react-native'; + + // these imports make headers and buttons look better + import { + Header, + Button, + } from 'react-native-elements'; + +function play(name) { + // Play handler + axios.get('http://192.168.1.178:8080/play/'+name) + .then(res => { + // Still don't care about response + }) + + } + + + + const FilesScreen = ({ navigation }) => { + + const [movies, setValue] = useState(null); + + const baseURL = "http://192.168.1.178:8080"; + + const navigationOptions = ({ navigation }) => { + return { + title: navigation.getParam('otherParam', 'File Selection'), + headerStyle: { + backgroundColor: '#3333ff', + }, + headerTintColor: '#fff', + }; + }; + + useEffect(() => { + + axios.get(`${baseURL}/list/`).then((response) => { + setValue(response.data.data); + }); + }, []); + + + if (!movies) return null; + + return ( + + + Pick a movie + movies} + data={movies} + renderItem={({ item }) => { + return